You can install the package via composer:
composer require mindtwo/laravel-platform-manager
To publish the modules config file simply run
php artisan vendor:publish --provider="mindtwo\LaravelPlatformManager\Providers\LaravelPlatformManagerProvider" --tag=config
This publishes the platform-resolver.php
config file to your projects config folder.
Inside the config you can specify your Platform model which will be used by the package.
To publish the modules migrations file simply run
php artisan vendor:publish --provider="mindtwo\LaravelPlatformManager\Providers\LaravelPlatformManagerProvider" --tag=migrations```
After publishing run
php artisan migrate
To use the platforms with Laravel's Sanctum package you should add the middleware
mindtwo\LaravelPlatformManager\Middleware\StatefulPlatformDomais
to your project's
Kernel.php
. To be concrete to the middlewareGroup api
or your equivalent.
This middleware adds the plaform's hostnames to Sanctums Stateful Domains.
To receive the current platform you are working in simply inject mindtwo\LaravelPlatformManager\Services\PlatformResolver
to your service, controller, middleware, etc. Via the method getCurrentPlatform()
you can receive your platform model.
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.