Relation Manager policies

Hello guys! I'm implementing policies on my project and get a problem. I utilize the Relation Manager (attach) on some of my "policied idk if is correct to spell that way" resources. When i try to attach any register, all of them appears, like the example: I have a BusinessResource, that attaches Places with RelationManager, but when my user type is "user" instead "superuser", i need to search only places that have owner_id === auth()->user()->id. I will attach some files to try explain how i doing the policies. To filter on the list, i use the getEloquentQuery method, see bellow, but didnt work to attaches select:
php

public static function getEloquentQuery(): Builder
{
$query = parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);

if (!auth()->user()->isSuperUser()) {
$query->where('owner_id', auth()->id());
}

return $query;
}
php

public static function getEloquentQuery(): Builder
{
$query = parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);

if (!auth()->user()->isSuperUser()) {
$query->where('owner_id', auth()->id());
}

return $query;
}
4 Replies
Want results from more Discord servers?
Add your server