コード例 #1
0
 /**
  * Update an existing group.
  *
  * @param \CachetHQ\Cachet\Models\ComponentGroup $group
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function putGroup(ComponentGroup $group)
 {
     $groupData = array_filter(Binput::only(['name', 'order']));
     try {
         $group->update($groupData);
     } catch (Exception $e) {
         throw new BadRequestHttpException();
     }
     return $this->item($group);
 }
コード例 #2
0
 /**
  * Updates a component group.
  *
  * @param \CachetHQ\Cachet\Models\ComponentGroup $group
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function updateComponentGroupAction(ComponentGroup $group)
 {
     $groupData = Binput::get('group');
     try {
         $group->update($groupData);
     } catch (ValidationException $e) {
         return Redirect::route('dashboard.components.group.edit', ['id' => $group->id])->withInput(Binput::all())->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.components.groups.edit.failure')))->withErrors($e->getMessageBag());
     }
     return Redirect::route('dashboard.components.group.edit', ['id' => $group->id])->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.groups.edit.success')));
 }
コード例 #3
0
 /**
  * Updates a component group.
  *
  * @param \CachetHQ\Cachet\Models\ComponentGroup $group
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function updateComponentGroupAction(ComponentGroup $group)
 {
     $groupData = Binput::get('group');
     $group->update($groupData);
     if (!$group->isValid()) {
         segment_track('Dashboard', ['event' => 'Edit Component Group', 'success' => false]);
         return Redirect::back()->withInput(Binput::all())->with('title', sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.components.groups.edit.failure')))->with('errors', $group->getErrors());
     }
     segment_track('Dashboard', ['event' => 'Edit Component Group', 'success' => true]);
     $successMsg = sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.groups.edit.success'));
     return Redirect::back()->with('success', $successMsg);
 }