mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 19:14:04 +00:00
Simplify Tenant contract (remove run method), move run logic to Tenancy, add generics
This commit is contained in:
parent
32a063b834
commit
af3b693dd1
9 changed files with 39 additions and 26 deletions
|
|
@ -10,7 +10,7 @@ class CreateTenantStorage
|
|||
{
|
||||
public function handle(TenantCreated $event): void
|
||||
{
|
||||
$storage_path = $event->tenant->run(fn () => storage_path());
|
||||
$storage_path = tenancy()->run($event->tenant, fn () => storage_path());
|
||||
|
||||
mkdir("$storage_path", 0777, true); // Create the tenant's folder inside storage/
|
||||
mkdir("$storage_path/framework/cache", 0777, true); // Create /framework/cache inside the tenant's storage (used for e.g. real-time facades)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,6 @@ class DeleteTenantStorage
|
|||
{
|
||||
public function handle(DeletingTenant $event): void
|
||||
{
|
||||
File::deleteDirectory($event->tenant->run(fn () => storage_path()));
|
||||
File::deleteDirectory(tenancy()->run($event->tenant, fn () => storage_path()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue