From 457274c8cfd1e3ad4ea641893fdf5b8c478c66dd Mon Sep 17 00:00:00 2001 From: mikhailkonstan Date: Sat, 3 Aug 2024 14:54:31 +0200 Subject: [PATCH] Added: Deleting framework directories for tenants solution in realtime-facades --- source/docs/v3/realtime-facades.blade.md | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/source/docs/v3/realtime-facades.blade.md b/source/docs/v3/realtime-facades.blade.md index 308a14df..c2050f55 100644 --- a/source/docs/v3/realtime-facades.blade.md +++ b/source/docs/v3/realtime-facades.blade.md @@ -63,3 +63,40 @@ class CreateFrameworkDirectoriesForTenant } } ``` + +## Deleting framework directories for tenants {#deleting-framework-directories-for-tenants} + +If you used the previous solution and created the framework directories for a tenant, then you may be interested in +deleting the framework directories once the tenant has been destroyed. Similarly, you will have to create a new `Job` that +will remove any framework files created previously. + +Similarly, create a new `Job` like the one below, and add the `Job` to the `TenantDeleted` job pipeline + +```php +tenant = $tenant; + } + + public function handle(): void + { + $this->tenant->run(function ($tenant) { + $storage_path = storage_path(); + + File::deleteDirectory($storage_path); + }); + } +} +``` \ No newline at end of file