paginator($groups, $request); } /** * Get a single group. * * @param \CachetHQ\Cachet\Models\ComponentGroup $group * * @return \Illuminate\Http\JsonResponse */ public function getGroup(ComponentGroup $group) { return $this->item($group); } /** * Create a new component group. * * @return \Illuminate\Http\JsonResponse */ public function postGroups() { try { $group = $this->dispatch(new AddComponentGroupCommand( Binput::get('name'), Binput::get('order', 0) )); } catch (QueryException $e) { throw new BadRequestHttpException(); } return $this->item($group); } /** * Update an existing group. * * @param \CachetHQ\Cachet\Models\ComponentGroup $group * * @return \Illuminate\Http\JsonResponse */ public function putGroup(ComponentGroup $group) { try { $group = $this->dispatch(new UpdateComponentGroupCommand( $group, Binput::get('name'), Binput::get('order', 0) )); } catch (QueryException $e) { throw new BadRequestHttpException(); } return $this->item($group); } /** * Delete an existing group. * * @param \CachetHQ\Cachet\Models\ComponentGroup $group * * @return \Illuminate\Http\JsonResponse */ public function deleteGroup(ComponentGroup $group) { $this->dispatch(new RemoveComponentGroupCommand($group)); return $this->noContent(); } }