I am using Laravel for my app and I would like to ask where is the best place to check permissions of an object.
Each model has checkPermissions() method.
So if user make a request to change model client router will call method updateClient() in controller. Should I do it like this:
$client = Client::find(Input::get('id'));
$client->checkPermissions();
or should I create a new method for getting client and check permission inside it? :
$client = Client::getClientById($id);
where getClientById() is method defined on Client model and it check permissions...
Can you describe also why you choose one or another solution? Thanks
Aucun commentaire:
Enregistrer un commentaire