jeudi 4 août 2022

Laravel permissions pivot table

I am making custom permissions,

I would like them to be divided into sections e.g. orders, customers etc. and each section would have some permission e.g. edit, delete, add. Just to check if a particular user has access I would have to start with the Section model?

Because I can't do something like Auth::user()->permissions()->with('sections')->contains('name','display')->contains('sections','order')

I would like to simply check if the user has access to, for example, order.display. I have a feeling that this section does not make sense here.

How to do it? I know there is a spatie(laravel-permission), but there is a role division there.

Example schema of the database (user_permission is a pivot): enter image description here



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/oIEAx5e
via IFTTT

Aucun commentaire:

Enregistrer un commentaire