I am currently studying framework Laraveland dingo api. Is there a way to integrate role-based permission using a power of attorney on dingo api?
So, for example, I have a route to get the entire list of users, but only the administrator can access it.
So, if the user is authenticated, but he is not an admin, he cannot access this route.
I tried to add middleware to trust route.php, but when I tried it on the postman, I got a syntax error.
here is my route.php file:
$api->version('v1', ['middleware' => ['jwt.auth', 'role:admin']], function ($api) {
$api->get('users', 'App\Http\Controllers\Auth\AuthController@index');
$api->get('user', 'App\Http\Controllers\Auth\AuthController@show');
});
source
share