1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 08:44:02 +00:00
tenancy/src/Jobs/QueuedTenantDatabaseDeleter.php
Samuel Štancl 3bb2759fe2
[3.x] DB users (#382)
* Initial draft

* Apply fixes from StyleCI

* Use CI on master branch too

* Pass correct argument to queued DB creators/deleters

* Apply fixes from StyleCI

* Remove new interface from MySQLDBManager

* Make phpunit run

* Apply fixes from StyleCI

* Fix static property

* Default databaseName

* Use database transactions for creating users & granting permissions

* Apply fixes from StyleCI

* Get old tests to pass

* Apply fixes from StyleCI

* Add tests for PermissionControlledMySQLDatabaseManager

* Apply fixes from StyleCI

* Write test for extra config, fix bug with extra config

* Apply fixes from StyleCI
2020-05-03 18:12:27 +02:00

40 lines
950 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\Contracts\TenantDatabaseManager;
use Stancl\Tenancy\Tenant;
class QueuedTenantDatabaseDeleter implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/** @var TenantDatabaseManager */
protected $databaseManager;
/** @var Tenant */
protected $tenant;
public function __construct(TenantDatabaseManager $databaseManager, Tenant $tenant)
{
$this->databaseManager = $databaseManager;
$this->tenant = $tenant;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$this->databaseManager->deleteDatabase($this->tenant);
}
}