An extension for using Laravel in a multi subdomains setting
Laravel | Package |
---|---|
9.x | 1.x-2.x (deprecated) |
10.x | 3.x-4.x |
11.x | 5.x |
To get the latest version of Mostbyte Multidomain
, simply require the project using Composer
composer require mostbyte/multidomain
Instead, you may of course manually update your requirement block and run composer update
if you so choose:
{
"require": {
"mostbyte/multidomain": "^5.0"
}
}
php artisan vendor:publish --provider="Mostbyte\Multidomain\MultidomainServiceProvider"
There is a helper mostbyteDomainManager
, that returns DomainManager
and you can use all methods which created in it, for example:
$subDomain = mostbyteDomainManager()->getSubDomain();
- First of all you need to create new schema with command below
php artisan mostbyte:schema {schema}
- Then you can run migration with following command and with all flags which exists in default Laravel
migrate
command
php mostbyte:migrate {schema}
{--force : Force the operation to run when in production}
{--realpath : Indicate any provided migration file paths are pre-resolved absolute paths}
{--pretend : Dump the SQL queries that would be run}
{--seed : Indicates if the seed task should be re-run}
{--step : Force the migrations to be run so they can be rolled back individually}
{--all : Run migrations for all schemas}
- Or there is the command for refreshing database
php mostbyte:fresh {schema}
{--realpath : Indicate any provided migration file paths are pre-resolved absolute paths}
{--seed : Indicates if the seed task should be re-run}
{--step : Force the migrations to be run so they can be rolled back individually}
- If you want to DELETE the schema with all data in, run this command
php artisan mostbyte:rollback {schema}