I was trying to use spatie role and permission but when i try to update role and permission it gives me the above error and highlights the if statement in the function below located inside the user model
public static function roleHasPermissions($role,$permissions){
$hasPermission=true;
// dd($role);
// dd($perm);
foreach($permissions as $permission){
if(!$role->hasPermissionTo($permission)){
$hasPermission=true;
}
}
return $hasPermission;
}
To update role and permission
The error simply implies that the permission you are checking for has not been created.
Check to ensure that the permission has been created before attempting to assign to a role.