1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-04 18:44:04 +00:00

Remove afterLink closures, add types, move actions, add usage explanation to the symlink trait

This commit is contained in:
lukinovec 2022-08-25 07:04:44 +02:00
parent f2d562cd8b
commit c4f65afa0a
6 changed files with 19 additions and 43 deletions

View file

@ -8,8 +8,8 @@ use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\LazyCollection;
use Stancl\Tenancy\Concerns\HasATenantsOption;
use Stancl\Tenancy\CreateStorageSymlinksAction;
use Stancl\Tenancy\RemoveStorageSymlinksAction;
use Stancl\Tenancy\Actions\CreateStorageSymlinksAction;
use Stancl\Tenancy\Actions\RemoveStorageSymlinksAction;
class Link extends Command
{
@ -55,31 +55,19 @@ class Link extends Command
}
}
/**
* @param LazyCollection $tenants
* @return void
*/
protected function removeLinks($tenants)
protected function removeLinks(LazyCollection $tenants): void
{
RemoveStorageSymlinksAction::handle(
$tenants,
afterLinkRemoval: fn ($publicPath) => $this->info("The [$publicPath] link has been removed.")
);
RemoveStorageSymlinksAction::handle($tenants);
$this->info('The links have been removed.');
}
/**
* @param LazyCollection $tenants
* @return void
*/
protected function createLinks($tenants)
protected function createLinks(LazyCollection $tenants): void
{
CreateStorageSymlinksAction::handle(
$tenants,
$this->option('relative') ?? false,
$this->option('force') ?? false,
afterLinkCreation: fn ($publicPath, $storagePath) => $this->info("The [$publicPath] link has been connected to [$storagePath].")
);
$this->info('The links have been created.');