/** * Execute the command. * * @return void */ public function handle() { $slug = Slug::create(['name' => $this->request->slug, 'slug_attribute_id' => self::SLUG_ATTRIBUTE_MENU]); $this->request['slug_id'] = $slug->id; $this->request['gallery'] = ''; // not yet implemented $content = Content::create($this->request->all()); Activity::create(['text' => $this->auth->linkedName() . ' created new content named ' . $content->linkedName(), 'user_id' => $this->auth->id]); Session::flash('flash_message', 'Your content has been created!'); }
/** * Execute the command. * * @return void */ public function handle() { $slug = Slug::create(['name' => $this->request->slug, 'slug_attribute_id' => self::SLUG_ATTRIBUTE_MENU]); $this->request['slug_id'] = $slug->id; $menu = new Menu($this->request->all()); $menu->generateOrder(); if ($menu->location_id == 0) { $parent = Menu::findOrFail($menu->parent_id); $menu->location_id = $parent->location_id; } $menu->save(); Activity::create(['text' => $this->auth->linkedName() . ' created new menu named ' . $menu->linkedName(), 'user_id' => $this->auth->id]); Session::flash('flash_message', 'Your menu has been created!'); }