mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 14:54:03 +00:00
Override migrate:fresh by extending FreshCommand in TenancyServiceProvider
This commit is contained in:
parent
6269dc95e4
commit
5fa50cdd49
1 changed files with 2 additions and 12 deletions
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||||
namespace Stancl\Tenancy;
|
namespace Stancl\Tenancy;
|
||||||
|
|
||||||
use Illuminate\Cache\CacheManager;
|
use Illuminate\Cache\CacheManager;
|
||||||
|
use Illuminate\Database\Console\Migrations\FreshCommand;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper;
|
use Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper;
|
||||||
|
|
@ -71,10 +72,6 @@ class TenancyServiceProvider extends ServiceProvider
|
||||||
$this->app->bind('globalCache', function ($app) {
|
$this->app->bind('globalCache', function ($app) {
|
||||||
return new CacheManager($app);
|
return new CacheManager($app);
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($this->app['config']['tenancy.database.drop_tenant_databases_on_migrate_fresh']) {
|
|
||||||
$this->app->extend('command.migrate.fresh', fn () => new Commands\MigrateFreshOverride);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bootstrap services. */
|
/* Bootstrap services. */
|
||||||
|
|
@ -95,7 +92,7 @@ class TenancyServiceProvider extends ServiceProvider
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($this->app['config']['tenancy.database.drop_tenant_databases_on_migrate_fresh']) {
|
if ($this->app['config']['tenancy.database.drop_tenant_databases_on_migrate_fresh']) {
|
||||||
$this->commands(Commands\MigrateFreshOverride::class);
|
$this->app->extend(FreshCommand::class, fn () => new Commands\MigrateFreshOverride);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->publishes([
|
$this->publishes([
|
||||||
|
|
@ -145,11 +142,4 @@ class TenancyServiceProvider extends ServiceProvider
|
||||||
return $instance;
|
return $instance;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provides()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'command.migrate.fresh',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue