Пример #1
0
 /**
  * Seed the component groups table.
  *
  * @return void
  */
 protected function seedComponentGroups()
 {
     $defaultGroups = [['name' => 'Websites', 'order' => 1, 'collapsed' => 0], ['name' => 'Alt Three', 'order' => 2, 'collapsed' => 1]];
     ComponentGroup::truncate();
     foreach ($defaultGroups as $group) {
         ComponentGroup::create($group);
     }
 }
Пример #2
0
 /**
  * Seed the component groups table.
  *
  * @return void
  */
 protected function seedComponentGroups()
 {
     $defaultGroups = [['name' => 'Websites', 'order' => 1]];
     ComponentGroup::truncate();
     foreach ($defaultGroups as $group) {
         ComponentGroup::create($group);
     }
 }
Пример #3
0
 /**
  * Create a new component group.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function postGroups()
 {
     $groupData = array_filter(Binput::only(['name', 'order']));
     try {
         $group = ComponentGroup::create($groupData);
     } catch (Exception $e) {
         throw new BadRequestHttpException();
     }
     return $this->item($group);
 }
Пример #4
0
 /**
  * Creates a new component.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postAddComponentGroup()
 {
     try {
         $group = ComponentGroup::create(Binput::get('group'));
     } catch (ValidationException $e) {
         return Redirect::back()->withInput(Binput::all())->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.components.groups.add.failure')))->withErrors($e->getMessageBag());
     }
     return Redirect::back()->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.groups.add.success')));
 }
Пример #5
0
 /**
  * Creates a new component.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postAddComponentGroup()
 {
     $group = ComponentGroup::create(Binput::get('group'));
     if (!$group->isValid()) {
         segment_track('Dashboard', ['event' => 'Created Component Group', 'success' => false]);
         return Redirect::back()->withInput(Binput::all())->with('title', sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.components.groups.add.failure')))->with('errors', $group->getErrors());
     }
     segment_track('Dashboard', ['event' => 'Created Component Group', 'success' => true]);
     $successMsg = sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.groups.add.success'));
     return Redirect::back()->with('success', $successMsg);
 }
 /**
  * Handle the add component group command.
  *
  * @param \CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand $command
  *
  * @return \CachetHQ\Cachet\Models\ComponentGroup
  */
 public function handle(AddComponentGroupCommand $command)
 {
     $group = ComponentGroup::create(['name' => $command->name, 'order' => $command->order, 'collapsed' => $command->collapsed]);
     event(new ComponentGroupWasAddedEvent($group));
     return $group;
 }