I receive a Sanctum guard error when I try to find a specific Role_id or Permission_id using a Spatie package in Laravel. It was working fine normally when I try to get all roles or permissions but it make an error only when I try to search for a specific id using Sanctum.
Controller
public function create()
{
$role = Role::orderBy('id', 'DESC')->get();
$role_user = Role::findById(3);
return response([
'status' => true,
'role' => $role,
'role_user' => $role_user
], 200);
}
Note: it works when I changed the guard manually in db from web to sanctum.
I am using Laravel 10. I have Installed Sanctum for Rest Apis, Spatie for ACL. basically it works fine but it give an error when i try to find specific role or permision by id.
i have tried change my guard in user but it not work, i tried to change guard manually in db for checking it was working but it's not proper good thing to do that.