Level 75
Not sure of all of your structure, but usually it's something like:
$whatever = Role::with('permissions')->get();
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have this tables:
users
permissions
roles
role_user
permission_role
i want check Permissions through roles . i use this function :
public function hasPermission(Permission $permission)
{
return $this->hasRole($permission->roles);
}
show error
App\Models\User::hasPermission(): Argument #1 ($permission) must be of type App\Models\Permission, string given, called in
Not sure of all of your structure, but usually it's something like:
$whatever = Role::with('permissions')->get();
Please or to participate in this conversation.