i am having issues with getting the spatie roles and permissions running in Filament php with the package from spatie and Althinect/filament-spatie-roles-permissions, but i am not sure where the issue is located. I have installed everything according the instructions and i have added a Super Admin based on the instruction and everything is working fine. When I add now a role with specific permissions (permissions generated via artisan permission:sync) and add a user to the role, the user has no access. I have also changed the view method within the policy to return true instead of the can('view_fault') and then the rights are correct. Does anyone have any idea what there is missing? Thanks for your help. Armin
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\Fault;
use Illuminate\Auth\Access\HandlesAuthorization;
class FaultPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\Fault $fault
* @return bool
*/
public function view(User $user, Fault $fault): bool
{
return $user->can('view_fault');
}
after several different checks, it seems that the can() helper is not working, if I use hasPermissionTo() the system finds the related permission. Anyone who can help?