Coder Social home page Coder Social logo

kalessil / laravel-foundation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from intellishop/laravel-foundation

0.0 2.0 0.0 627 KB

Integrates multi-tenant, localization, permissions and more laravel extensions to work out of the box.

License: MIT License

PHP 100.00%

laravel-foundation's Introduction

laravel-foundation

Integrates multi-tenant, localization, permissions and more laravel extensions to work out of the box.

To be more specific, following extensions are bundled:

  • laravel/framework (5.6)
  • laravel/passport
  • mcamara/laravel-localization
  • hyn/multi-tenant
  • spatie/laravel-permission

Features

  • separated tenancy and tenant databases (incl. tenant-scope migrations)
  • host-level language and timezone settings
  • automatic locale detection and injection into URL
  • passport and permissions extensions configured to work in tenant scope

Installation notes

The extension is being published, hence installation instructions are not yet provided.

  • add intellishop/laravel-foundation package as a dependency into your application
  • run composer update and php artisan jwt:secret
  • configure databases (in .env file) similar to this:
DB_CONNECTION=system
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=tenancy
DB_USERNAME=<username>
DB_PASSWORD=<password>

TENANCY_HOST=127.0.0.1
TENANCY_PORT=3306
TENANCY_DATABASE=tenancy
TENANCY_USERNAME=<username>
TENANCY_PASSWORD=<password>
LIMIT_UUID_LENGTH_32=true
  • run php artisan migrate to create tenancy tables
  • register a new tenant with e.g. German time and language applied by default
    • insert into websites (uuid) values ('master'), assuming the inserted row id is 1
    • insert into hostnames (fqdn, website_id, locale, timezone) values ('localhost', 1, 'de', 'CET')
  • run php artisan tenancy:recreate in order to create tenants databases
    • might fail on MySQL/MariaDB due to permissions issues
    • if so, check \Hyn\Tenancy\Generators\Webserver\Database\Drivers\MariaDB::created for queries and execute them manually
  • run php artisan tenancy:migrate to migrate tenants databases
  • run php artisan tenancy:passport:install to install passport

Development notes

Some routes might need update due to localization functionality (automatic redirect to //):

Route::group(
    [
        'prefix'     => LaravelLocalization::setLocale(),
        'middleware' => ['localeSessionRedirect', 'localizationRedirect'],
    ],
    function (): void {
        Route::get(<url>, <handler>);
    }
);

Also entities and migrations might need tweaks similar to ones in this package (please reference to source code).

Nova

It is required to adjust \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationMiddlewareBase class:

    protected $except = [
        '/nova',
        '/nova/*',
        '/nova-api/*',
    ];

laravel-foundation's People

Contributors

kalessil avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.