Add groups accounts fetching with dedicated route

This commit is contained in:
Bubka
2021-09-22 22:50:45 +02:00
parent 9a7ef19177
commit 037ebaa8ba
6 changed files with 74 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ use App\Services\GroupService;
use App\Http\Requests\GroupStoreRequest;
use App\Http\Requests\GroupAssignRequest;
use App\Http\Resources\GroupResource;
use App\Http\Resources\TwoFAccountCollection;
use Illuminate\Http\Request;
class GroupController extends Controller
@@ -109,6 +110,21 @@ class GroupController extends Controller
}
/**
* Get accounts assign to the group
*
* @param \App\Group $group
* @return \App\Http\Resources\TwoFAccountCollection
*/
public function accounts(Group $group)
{
$groups = $this->groupService->getAccounts($group);
return new TwoFAccountCollection($groups);
}
/**
* Remove the specified resource from storage.
*