mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 16:34:04 +00:00
Add conditional loading for Laravel version 8 and up
The schema dump functionality is not available in laravel version 7 or older
This commit is contained in:
parent
b0dfe338c7
commit
838a257fb3
2 changed files with 14 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ namespace Stancl\Tenancy;
|
|||
|
||||
use Illuminate\Cache\CacheManager;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Str;
|
||||
use Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper;
|
||||
use Stancl\Tenancy\Contracts\Domain;
|
||||
use Stancl\Tenancy\Contracts\Tenant;
|
||||
|
|
@ -86,12 +87,14 @@ class TenancyServiceProvider extends ServiceProvider
|
|||
Commands\Seed::class,
|
||||
Commands\Install::class,
|
||||
Commands\Migrate::class,
|
||||
Commands\Rollback::class,
|
||||
Commands\TenantDump::class,
|
||||
Commands\TenantList::class,
|
||||
Commands\MigrateFresh::class,
|
||||
]);
|
||||
|
||||
if ((int) Str::before($this->app->version(), '.') >= 8) {
|
||||
$this->commands([Commands\TenantDump::class]);
|
||||
}
|
||||
|
||||
$this->publishes([
|
||||
__DIR__ . '/../assets/config.php' => config_path('tenancy.php'),
|
||||
], 'config');
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Artisan;
|
|||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
use Stancl\JobPipeline\JobPipeline;
|
||||
use Stancl\Tenancy\Bootstrappers\DatabaseTenancyBootstrapper;
|
||||
use Stancl\Tenancy\Events\TenancyEnded;
|
||||
|
|
@ -94,6 +95,10 @@ class CommandsTest extends TestCase
|
|||
/** @test */
|
||||
public function migrate_command_loads_schema_state()
|
||||
{
|
||||
if ((int) Str::before($this->app->version(), '.') < 8) {
|
||||
$this->markTestSkipped("'Laravel version doesn't support schema dumps.'");
|
||||
}
|
||||
|
||||
$tenant = Tenant::create();
|
||||
|
||||
$this->assertFalse(Schema::hasTable('schema_users'));
|
||||
|
|
@ -114,6 +119,10 @@ class CommandsTest extends TestCase
|
|||
/** @test */
|
||||
public function dump_command_works()
|
||||
{
|
||||
if ((int) Str::before($this->app->version(), '.') < 9) {
|
||||
$this->markTestSkipped("'Laravel version doesn't support schema dumps.'");
|
||||
}
|
||||
|
||||
$tenant = Tenant::create();
|
||||
Artisan::call('tenants:migrate');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue