1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-15 13:04:03 +00:00

Fixed Link command for Laravel v6, added StorageLink Events, more StorageLink tests, added RemoveStorageSymlinks Job, added Storage Jobs to TenancyServiceProvider stub, renamed misleading config example.

This commit is contained in:
Martin Vlček 2021-09-13 19:22:06 +02:00
parent 717b834c51
commit 5ed5aea6d6
11 changed files with 253 additions and 15 deletions

View file

@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Artisan;
use Stancl\Tenancy\Contracts\Tenant;
use Stancl\Tenancy\Events\CreatingStorageSymlink;
use Stancl\Tenancy\Events\RemovingStorageSymlink;
use Stancl\Tenancy\Events\StorageSymlinkCreated;
use Stancl\Tenancy\Events\StorageSymlinkRemoved;
class RemoveStorageSymlinks implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* @var \Stancl\Tenancy\Contracts\Tenant
*/
public Tenant $tenant;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Tenant $tenant)
{
$this->tenant = $tenant;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
event(new RemovingStorageSymlink($this->tenant));
Artisan::call('tenants:link', [
'--remove' => true,
'--tenants' => [$this->tenant->getTenantKey()],
]);
event(new StorageSymlinkRemoved($this->tenant));
}
}