canAccess function generate a lot of duplicate queries
Hello, I have a custom page in filament and I want to restrict acces to it only for some users, for this I'm using the canAccess function from the filament Page class
this is the condition:
public static function canAccess(): bool
{
$event_user = Filament::getTenant()->eventContestants()->where('user_id', auth()->id())->get();
return !$event_user->isEmpty();
}
and for some reason this generates a lot of duplicate queries, the example from the screenshot is with a few dummy data, but on live env there are like 180 duplicate queries and the page is loading super slow (± 5sec)
I'm doing something wrong? Maybe I don't use filament as it should be used? Any advice? Thank you
this is the condition:
public static function canAccess(): bool
{
$event_user = Filament::getTenant()->eventContestants()->where('user_id', auth()->id())->get();
return !$event_user->isEmpty();
}
and for some reason this generates a lot of duplicate queries, the example from the screenshot is with a few dummy data, but on live env there are like 180 duplicate queries and the page is loading super slow (± 5sec)
I'm doing something wrong? Maybe I don't use filament as it should be used? Any advice? Thank you
