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

Add types to $tenants in the action handle() methods

This commit is contained in:
lukinovec 2022-08-31 08:34:41 +02:00
parent dcf29ee8c9
commit 59af5f47c7
2 changed files with 10 additions and 6 deletions

View file

@ -5,16 +5,18 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Actions; namespace Stancl\Tenancy\Actions;
use Exception; use Exception;
use Stancl\Tenancy\Concerns\DealsWithTenantSymlinks; use Illuminate\Support\Collection;
use Illuminate\Support\LazyCollection;
use Stancl\Tenancy\Database\Models\Tenant; use Stancl\Tenancy\Database\Models\Tenant;
use Stancl\Tenancy\Events\CreatingStorageSymlink;
use Stancl\Tenancy\Events\StorageSymlinkCreated; use Stancl\Tenancy\Events\StorageSymlinkCreated;
use Stancl\Tenancy\Events\CreatingStorageSymlink;
use Stancl\Tenancy\Concerns\DealsWithTenantSymlinks;
class CreateStorageSymlinksAction class CreateStorageSymlinksAction
{ {
use DealsWithTenantSymlinks; use DealsWithTenantSymlinks;
public static function handle($tenants, bool $relativeLink = false, bool $force = false): void public static function handle(Tenant|Collection|LazyCollection $tenants, bool $relativeLink = false, bool $force = false): void
{ {
$tenants = $tenants instanceof Tenant ? collect([$tenants]) : $tenants; $tenants = $tenants instanceof Tenant ? collect([$tenants]) : $tenants;

View file

@ -4,16 +4,18 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Actions; namespace Stancl\Tenancy\Actions;
use Stancl\Tenancy\Concerns\DealsWithTenantSymlinks; use Illuminate\Support\Collection;
use Illuminate\Support\LazyCollection;
use Stancl\Tenancy\Database\Models\Tenant; use Stancl\Tenancy\Database\Models\Tenant;
use Stancl\Tenancy\Events\RemovingStorageSymlink;
use Stancl\Tenancy\Events\StorageSymlinkRemoved; use Stancl\Tenancy\Events\StorageSymlinkRemoved;
use Stancl\Tenancy\Events\RemovingStorageSymlink;
use Stancl\Tenancy\Concerns\DealsWithTenantSymlinks;
class RemoveStorageSymlinksAction class RemoveStorageSymlinksAction
{ {
use DealsWithTenantSymlinks; use DealsWithTenantSymlinks;
public static function handle($tenants): void public static function handle(Tenant|Collection|LazyCollection $tenants): void
{ {
$tenants = $tenants instanceof Tenant ? collect([$tenants]) : $tenants; $tenants = $tenants instanceof Tenant ? collect([$tenants]) : $tenants;