mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 18:04:03 +00:00
Add more events
This commit is contained in:
parent
ed96aee669
commit
b87c0bc9d2
22 changed files with 165 additions and 52 deletions
|
|
@ -4,10 +4,7 @@ namespace Stancl\Tenancy\Database\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Stancl\Tenancy\Contracts\Tenant;
|
||||
use Stancl\Tenancy\Events\DomainCreated;
|
||||
use Stancl\Tenancy\Events\DomainDeleted;
|
||||
use Stancl\Tenancy\Events\DomainSaved;
|
||||
use Stancl\Tenancy\Events\DomainUpdated;
|
||||
use Stancl\Tenancy\Events;
|
||||
use Stancl\Tenancy\Exceptions\DomainOccupiedByOtherTenantException;
|
||||
use Stancl\Tenancy\Contracts;
|
||||
use Stancl\Tenancy\Database\Concerns\CentralConnection;
|
||||
|
|
@ -42,10 +39,14 @@ class Domain extends Model implements Contracts\Domain
|
|||
return $this->belongsTo(config('tenancy.tenant_model'));
|
||||
}
|
||||
|
||||
public $dispatchEvents = [
|
||||
'saved' => DomainSaved::class,
|
||||
'created' => DomainCreated::class,
|
||||
'updated' => DomainUpdated::class,
|
||||
'deleted' => DomainDeleted::class,
|
||||
public $dispatchesEvents = [
|
||||
'saved' => Events\DomainSaved::class,
|
||||
'saving' => Events\SavingDomain::class,
|
||||
'created' => Events\DomainCreated::class,
|
||||
'creating' => Events\CreatingDomain::class,
|
||||
'updated' => Events\DomainUpdated::class,
|
||||
'updating' => Events\UpdatingDomain::class,
|
||||
'deleted' => Events\DomainDeleted::class,
|
||||
'deleting' => Events\DeletingDomain::class,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,8 +83,12 @@ class Tenant extends Model implements Contracts\Tenant
|
|||
|
||||
public $dispatchesEvents = [
|
||||
'saved' => Events\TenantSaved::class,
|
||||
'saving' => Events\SavingTenant::class,
|
||||
'created' => Events\TenantCreated::class,
|
||||
'creating' => Events\CreatingTenant::class,
|
||||
'updated' => Events\TenantUpdated::class,
|
||||
'updating' => Events\UpdatingTenant::class,
|
||||
'deleted' => Events\TenantDeleted::class,
|
||||
'deleting' => Events\DeletingTenant::class,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
7
src/Events/BootstrappingTenancy.php
Normal file
7
src/Events/BootstrappingTenancy.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class BootstrappingTenancy extends Contracts\TenancyEvent
|
||||
{
|
||||
}
|
||||
16
src/Events/Contracts/TenancyEvent.php
Normal file
16
src/Events/Contracts/TenancyEvent.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events\Contracts;
|
||||
|
||||
use Stancl\Tenancy\Tenancy;
|
||||
|
||||
abstract class TenancyEvent
|
||||
{
|
||||
/** @var Tenancy */
|
||||
public $tenancy;
|
||||
|
||||
public function __construct(Tenancy $tenancy)
|
||||
{
|
||||
$this->tenancy = $tenancy;
|
||||
}
|
||||
}
|
||||
7
src/Events/CreatingDomain.php
Normal file
7
src/Events/CreatingDomain.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class CreatingDomain extends Contracts\DomainEvent
|
||||
{
|
||||
}
|
||||
7
src/Events/CreatingTenant.php
Normal file
7
src/Events/CreatingTenant.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class CreatingTenant extends Contracts\TenantEvent
|
||||
{
|
||||
}
|
||||
7
src/Events/DeletingDomain.php
Normal file
7
src/Events/DeletingDomain.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class DeletingDomain extends Contracts\DomainEvent
|
||||
{
|
||||
}
|
||||
7
src/Events/DeletingTenant.php
Normal file
7
src/Events/DeletingTenant.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class DeletingTenant extends Contracts\TenantEvent
|
||||
{
|
||||
}
|
||||
7
src/Events/EndingTenancy.php
Normal file
7
src/Events/EndingTenancy.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class EndingTenancy extends Contracts\TenancyEvent
|
||||
{
|
||||
}
|
||||
7
src/Events/InitializingTenancy.php
Normal file
7
src/Events/InitializingTenancy.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class InitializingTenancy extends Contracts\TenancyEvent
|
||||
{
|
||||
}
|
||||
|
|
@ -2,15 +2,6 @@
|
|||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
use Stancl\Tenancy\Tenancy;
|
||||
|
||||
class RevertedToCentralContext
|
||||
class RevertedToCentralContext extends Contracts\TenancyEvent
|
||||
{
|
||||
/** @var Tenancy */
|
||||
public $tenancy;
|
||||
|
||||
public function __construct(Tenancy $tenancy)
|
||||
{
|
||||
$this->tenancy = $tenancy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
7
src/Events/RevertingToCentralContext.php
Normal file
7
src/Events/RevertingToCentralContext.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class RevertingToCentralContext extends Contracts\TenancyEvent
|
||||
{
|
||||
}
|
||||
6
src/Events/SavedDomain.php
Normal file
6
src/Events/SavedDomain.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class SavedDomain extends Contracts\DomainEvent
|
||||
{}
|
||||
7
src/Events/SavedTenant.php
Normal file
7
src/Events/SavedTenant.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class SavedTenant extends Contracts\TenantEvent
|
||||
{
|
||||
}
|
||||
7
src/Events/SavingDomain.php
Normal file
7
src/Events/SavingDomain.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class SavingDomain extends Contracts\DomainEvent
|
||||
{
|
||||
}
|
||||
7
src/Events/SavingTenant.php
Normal file
7
src/Events/SavingTenant.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class SavingTenant extends Contracts\TenantEvent
|
||||
{
|
||||
}
|
||||
|
|
@ -2,15 +2,6 @@
|
|||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
use Stancl\Tenancy\Tenancy;
|
||||
|
||||
class TenancyBootstrapped
|
||||
class TenancyBootstrapped extends Contracts\TenancyEvent
|
||||
{
|
||||
/** @var Tenancy */
|
||||
public $tenancy;
|
||||
|
||||
public function __construct(Tenancy $tenancy)
|
||||
{
|
||||
$this->tenancy = $tenancy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,15 +2,6 @@
|
|||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
use Stancl\Tenancy\Tenancy;
|
||||
|
||||
class TenancyEnded
|
||||
class TenancyEnded extends Contracts\TenancyEvent
|
||||
{
|
||||
/** @var Tenancy */
|
||||
public $tenancy;
|
||||
|
||||
public function __construct(Tenancy $tenancy)
|
||||
{
|
||||
$this->tenancy = $tenancy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,15 +2,6 @@
|
|||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
use Stancl\Tenancy\Tenancy;
|
||||
|
||||
class TenancyInitialized
|
||||
class TenancyInitialized extends Contracts\TenancyEvent
|
||||
{
|
||||
/** @var Tenancy */
|
||||
public $tenancy;
|
||||
|
||||
public function __construct(Tenancy $tenancy)
|
||||
{
|
||||
$this->tenancy = $tenancy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
7
src/Events/UpdatingDomain.php
Normal file
7
src/Events/UpdatingDomain.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class UpdatingDomain extends Contracts\DomainEvent
|
||||
{
|
||||
}
|
||||
7
src/Events/UpdatingTenant.php
Normal file
7
src/Events/UpdatingTenant.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class UpdatingTenant extends Contracts\TenantEvent
|
||||
{
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue