1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 22:54:03 +00:00

Use MySQL by default; create migrations/tenant in tenancy:install

This commit is contained in:
Samuel Štancl 2019-08-17 16:33:22 +02:00
parent be077ae73c
commit 47fb158b59
3 changed files with 12 additions and 4 deletions

View file

@ -19,7 +19,7 @@ return [
// 'localhost', // 'localhost',
], ],
'database' => [ 'database' => [
'based_on' => 'sqlite', 'based_on' => 'mysql',
'prefix' => 'tenant', 'prefix' => 'tenant',
'suffix' => '', 'suffix' => '',
], ],

View file

@ -41,8 +41,9 @@ class Install extends Command
)); ));
$this->info('✔️ Set middleware priority'); $this->info('✔️ Set middleware priority');
\file_put_contents(base_path('routes/tenant.php'), \file_put_contents(
"<?php base_path('routes/tenant.php'),
"<?php
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -58,7 +59,8 @@ class Install extends Command
Route::get('/your/application/homepage', function () { Route::get('/your/application/homepage', function () {
return 'This is your multi-tenant application. The uuid of the current tenant is ' . tenant('uuid'); return 'This is your multi-tenant application. The uuid of the current tenant is ' . tenant('uuid');
}); });
"); "
);
$this->info('✔️ Created routes/tenant.php'); $this->info('✔️ Created routes/tenant.php');
$this->line(''); $this->line('');
@ -71,6 +73,11 @@ Route::get('/your/application/homepage', function () {
$this->info('✔️ Created migration.'); $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.'); $this->comment('✨️ stancl/tenancy installed successfully.');
} }
} }

View file

@ -213,6 +213,7 @@ class Kernel extends HttpKernel
$this->assertFileExists(base_path('routes/tenant.php')); $this->assertFileExists(base_path('routes/tenant.php'));
$this->assertFileExists(base_path('config/tenancy.php')); $this->assertFileExists(base_path('config/tenancy.php'));
$this->assertFileExists(database_path('migrations/2019_08_08_000000_create_tenants_table.php')); $this->assertFileExists(database_path('migrations/2019_08_08_000000_create_tenants_table.php'));
$this->assertDirectoryExists(database_path('migrations/tenant'));
$this->assertSame("<?php $this->assertSame("<?php
namespace App\Http; namespace App\Http;