mercredi 16 juin 2021

Laravel Permissions Always return TRUE

I'm trying to create a condition for a button using permissions, but even though the permission is not assigned to the user, it returns TRUE... always.

This is what I have in my controller:

public function edit($id){
    $permisos = Auth::user()->hasPermissionTo('listaPrecios.utilidadCero');
    dd($permisos);

    return view('panel.lista_precio.lista_precio_edit')
        ->with( 'permisos' , $permisos);
}

The dd is only to check its status.

Could you help me to resolve this issue? I saw different posts where if you use Can it works, unfortunately it did not work for me either.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire