Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Baspa committed Nov 28, 2024
1 parent 7fac4c1 commit 26e8bb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Models/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected static function booted()
$currentTenant = app($tenantModel)->current();

if ($currentTenant) {
$model->{$tenantRelationship . '_id'} = $currentTenant->id;
$model->{$tenantRelationship . '_ulid'} = $currentTenant->id;
}
}
});
Expand All @@ -53,7 +53,7 @@ public function tenant()
if ($tenantRelationship && class_exists($tenantModel)) {
return $this->belongsTo(
$tenantModel,
$tenantRelationship . '_id'
$tenantRelationship . '_ulid'
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Resources/MediaResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function isScopedToTenant(): bool

public static function getTenantOwnershipRelationshipName(): string
{
return config('media-picker.tenant_ownership_relationship_name') ?? Filament::getTenantOwnershipRelationshipName();
return config('media-picker.tenant_relationship') ?? Filament::getTenantOwnershipRelationshipName();
}

public static function getModelLabel(): string
Expand Down Expand Up @@ -65,7 +65,7 @@ public static function getNavigationBadge(): ?string

if (Filament::hasTenancy() && config('media-picker.is_tenant_aware')) {
return static::getEloquentQuery()
->where(config('media-picker.tenant_ownership_relationship_name') . '_id', Filament::getTenant()->id)
->where(config('media-picker.tenant_relationship') . '_ulid', Filament::getTenant()->id)
->count();
}

Expand Down

0 comments on commit 26e8bb1

Please sign in to comment.