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

Simplify Tenant contract (remove run method), move run logic to Tenancy, add generics

This commit is contained in:
Samuel Štancl 2024-03-01 08:42:11 +01:00
parent 32a063b834
commit af3b693dd1
9 changed files with 39 additions and 26 deletions

View file

@ -4,10 +4,10 @@ declare(strict_types=1);
namespace Stancl\Tenancy\ResourceSyncing;
use Stancl\Tenancy\Contracts\Tenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\Relations\MorphPivot;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Stancl\Tenancy\Contracts\Tenant;
/**
* Used on pivot models.
@ -31,7 +31,7 @@ trait TriggerSyncingEvents
* @var static&Pivot $pivot
* @var SyncMaster|null $centralResource
* @var (Tenant&Model)|null $tenant
*/
*/
[$centralResource, $tenant] = $pivot->getCentralResourceAndTenant();
if ($tenant && $centralResource?->shouldSync()) {
@ -44,7 +44,7 @@ trait TriggerSyncingEvents
* @var static&Pivot $pivot
* @var SyncMaster|null $centralResource
* @var (Tenant&Model)|null $tenant
*/
*/
[$centralResource, $tenant] = $pivot->getCentralResourceAndTenant();
if ($tenant && $centralResource?->shouldSync()) {