php - How to add a user-defined policy in laravel -
i know laravel has pre-defined policy methods create, update, delete , view, question how can create 1 , use in program? i've tried define method in policy file, , call in controller, didn't work, , report 403 forbidden error. bellow did:
//a method in userpolicy.php file public function get(user $user, user $target){ return true; }
and called in usercontroller.php
$this->authorize('get', $user, user::class);
it won't work in anyway.
Comments
Post a Comment