mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 12:24:04 +00:00
Use MySQL by default; create migrations/tenant in tenancy:install
This commit is contained in:
parent
be077ae73c
commit
47fb158b59
3 changed files with 12 additions and 4 deletions
|
|
@ -19,7 +19,7 @@ return [
|
|||
// 'localhost',
|
||||
],
|
||||
'database' => [
|
||||
'based_on' => 'sqlite',
|
||||
'based_on' => 'mysql',
|
||||
'prefix' => 'tenant',
|
||||
'suffix' => '',
|
||||
],
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ class Install extends Command
|
|||
));
|
||||
$this->info('✔️ Set middleware priority');
|
||||
|
||||
\file_put_contents(base_path('routes/tenant.php'),
|
||||
\file_put_contents(
|
||||
base_path('routes/tenant.php'),
|
||||
"<?php
|
||||
|
||||
/*
|
||||
|
|
@ -58,7 +59,8 @@ class Install extends Command
|
|||
Route::get('/your/application/homepage', function () {
|
||||
return 'This is your multi-tenant application. The uuid of the current tenant is ' . tenant('uuid');
|
||||
});
|
||||
");
|
||||
"
|
||||
);
|
||||
$this->info('✔️ Created routes/tenant.php');
|
||||
|
||||
$this->line('');
|
||||
|
|
@ -71,6 +73,11 @@ Route::get('/your/application/homepage', function () {
|
|||
$this->info('✔️ Created migration.');
|
||||
}
|
||||
|
||||
if (! \is_dir(database_path('migrations/tenant'))) {
|
||||
mkdir(database_path('migrations/tenant'));
|
||||
$this->info('✔️ Created database/migrations/tenant folder.');
|
||||
}
|
||||
|
||||
$this->comment('✨️ stancl/tenancy installed successfully.');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,6 +213,7 @@ class Kernel extends HttpKernel
|
|||
$this->assertFileExists(base_path('routes/tenant.php'));
|
||||
$this->assertFileExists(base_path('config/tenancy.php'));
|
||||
$this->assertFileExists(database_path('migrations/2019_08_08_000000_create_tenants_table.php'));
|
||||
$this->assertDirectoryExists(database_path('migrations/tenant'));
|
||||
$this->assertSame("<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue