mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 11:34:03 +00:00
parent
3f650d887d
commit
15766a0037
12 changed files with 230 additions and 102 deletions
42
src/Jobs/QueuedTenantDatabaseDeleter.php
Normal file
42
src/Jobs/QueuedTenantDatabaseDeleter.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Stancl\Tenancy\Interfaces\TenantDatabaseManager;
|
||||
|
||||
class QueuedTenantDatabaseDeleter implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
protected $databaseManager;
|
||||
protected $databaseName;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param DatabaseCreator $databaseCreator
|
||||
* @param string $databaseName
|
||||
* @param string $action
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(TenantDatabaseManager $databaseManager, string $databaseName)
|
||||
{
|
||||
$this->databaseManager = $databaseManager;
|
||||
$this->databaseName = $databaseName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->databaseManager->deleteDatabase($databaseName);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue