mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 10:54:04 +00:00
33 lines
781 B
PHP
33 lines
781 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Stancl\Tenancy\Jobs;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Stancl\Tenancy\Database\Models\Tenant;
|
|
use Stancl\Tenancy\Events\DatabaseDeleted;
|
|
|
|
class DeleteDatabase implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
/** @var Tenant */
|
|
protected $tenant;
|
|
|
|
public function __construct(Tenant $tenant)
|
|
{
|
|
$this->tenant = $tenant;
|
|
}
|
|
|
|
public function handle()
|
|
{
|
|
$this->tenant->database()->manager()->deleteDatabase($this->tenant);
|
|
|
|
event(new DatabaseDeleted($this->tenant));
|
|
}
|
|
}
|