Skip to content

Commit

Permalink
Adding route to get all roles unpaginated
Browse files Browse the repository at this point in the history
  • Loading branch information
nWidart committed Oct 12, 2017
1 parent df68e51 commit 03e6af5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Modules/User/Http/Controllers/Api/RoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public function __construct(RoleRepository $role, PermissionManager $permissions
$this->permissions = $permissions;
}

public function all()
{
return RoleTransformer::collection($this->role->all());
}

public function index(Request $request)
{
return RoleTransformer::collection($this->role->serverPaginationFilteringFor($request));
Expand Down
5 changes: 5 additions & 0 deletions Modules/User/Http/apiRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
'uses' => 'RoleController@index',
'middleware' => 'token-can:user.roles.index',
]);
$router->get('all', [
'as' => 'api.user.role.all',
'uses' => 'RoleController@all',
'middleware' => 'token-can:user.roles.index',
]);
$router->post('/', [
'as' => 'api.user.role.store',
'uses' => 'RoleController@store',
Expand Down

0 comments on commit 03e6af5

Please sign in to comment.