mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 12:54:05 +00:00
Remove obsolete files, restructure
This commit is contained in:
parent
fbe43fbb04
commit
4f8d892481
20 changed files with 19 additions and 83 deletions
28
src/Concerns/CreatesDatabaseUsers.php
Normal file
28
src/Concerns/CreatesDatabaseUsers.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Concerns;
|
||||
|
||||
use Stancl\Tenancy\Contracts\TenantWithDatabase;
|
||||
|
||||
trait CreatesDatabaseUsers
|
||||
{
|
||||
public function createDatabase(TenantWithDatabase $tenant): bool
|
||||
{
|
||||
return $this->database()->transaction(function () use ($tenant) {
|
||||
parent::createDatabase($tenant);
|
||||
|
||||
return $this->createUser($tenant->database());
|
||||
});
|
||||
}
|
||||
|
||||
public function deleteDatabase(TenantWithDatabase $tenant): bool
|
||||
{
|
||||
return $this->database()->transaction(function () use ($tenant) {
|
||||
parent::deleteDatabase($tenant);
|
||||
|
||||
return $this->deleteUser($tenant->database());
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue