mardi 1 décembre 2015

Laravel 5 user role check

I have some trouble figuring out how to do this properly. I have Users that can create Articles which can be viewed, edited and deleted. I want to restrict the edit and delete actions if the currently logged in user is not the creator of the Article. I have already done this using Policies and use Gate within a Form Request, but if i understand correctly FormRequest is only for POST requests. And I currently pass the FormRequest as a parameter to the getEdit() action. That seems wrong.

So how can I make sure the user can neither access nor edit the Article?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire