Loading models twice #1839
Replies: 2 comments 7 replies
-
I did not understand your question, if you mean running two sqls, one for roles and one for permissions, that's the way laravel handles relationships and that does not belong in this package, use |
Beta Was this translation helpful? Give feedback.
-
As mentioned I am sharing After that, when accessing an endpoint, let's say public function viewAny(User $user)
{
if ($user->can('view clients')) {
return true;
}
} Laravel then resolves the Any good idea how to avoid this? Thank you, |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am passing an array with the user
roles
andpermissions
back with the request to the client for authorization on the front end.And using
roles
andpermissions
on theController
policies as well, the end result is that I load theSpatie\Permission\Models\Permission
&Spatie\Permission\Models\Role
twice.Any good idea how to avoid loading it twice and save memory?
Thank you,
Tal
Beta Was this translation helpful? Give feedback.
All reactions