Edward Kenway
Edward Kenway
FFilament
Created by Edward Kenway on 10/18/2024 in #❓┊help
how to properly show resource list with join or relation
php
public static function getEloquentQuery(): Builder
{
if (auth()->user()->hasRole('super_admin')) {
return parent::getEloquentQuery();
}
return parent::getEloquentQuery()->whereHas('users', function ($query) {
$query->where('user_id', auth()->id());
});
}
php
public static function getEloquentQuery(): Builder
{
if (auth()->user()->hasRole('super_admin')) {
return parent::getEloquentQuery();
}
return parent::getEloquentQuery()->whereHas('users', function ($query) {
$query->where('user_id', auth()->id());
});
}
could've used whereHas
3 replies