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

-ing event behavior

This commit is contained in:
Samuel Štancl 2020-05-21 17:55:48 +02:00
parent c40dba4e02
commit 33d6fd82da
9 changed files with 120 additions and 6 deletions

View file

@ -12,6 +12,7 @@ use Stancl\Tenancy\DatabaseManager;
use Stancl\Tenancy\Events\DatabaseMigrated;
use Stancl\Tenancy\Concerns\DealsWithMigrations;
use Stancl\Tenancy\Concerns\HasATenantsOption;
use Stancl\Tenancy\Events\MigratingDatabase;
class Migrate extends MigrateCommand
{
@ -59,6 +60,8 @@ class Migrate extends MigrateCommand
tenancy()->runForMultiple($this->option('tenants'), function ($tenant) {
$this->line("Tenant: {$tenant['id']}");
event(new MigratingDatabase($tenant));
// Migrate
parent::handle();

View file

@ -10,6 +10,7 @@ use Stancl\Tenancy\Contracts\TenantWithDatabase;
use Stancl\Tenancy\DatabaseManager;
use Stancl\Tenancy\Events\DatabaseSeeded;
use Stancl\Tenancy\Concerns\HasATenantsOption;
use Stancl\Tenancy\Events\SeedingDatabase;
class Seed extends SeedCommand
{
@ -58,6 +59,8 @@ class Seed extends SeedCommand
tenancy()->runForMultiple($this->option('tenants'), function ($tenant) {
$this->line("Tenant: {$tenant['id']}");
event(new SeedingDatabase($tenant));
// Seed
parent::handle();