/**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     //
     Navigation::where('href', '=', '/register')->unpublished()->update(['published' => null]);
     Navigation::where('href', '=', '/contact')->where('styles', '=', 'register-now')->update(['styles' => 'register-now']);
     Schema::table('navigations', function ($t) {
         $t->renameColumn('styles', 'class');
     });
 }
示例#2
0
 /**
  * 注册公共数据
  */
 public function setCommonData()
 {
     $data['navigationList'] = Navigation::getNavigationTreeArray();
     //导航列表数组
     $data['hotArticleList'] = Article::getHotArticleList(5);
     //热门文章列表
     $data['tagsList'] = Tags::orderBy('number', 'desc')->limit(15)->get();
     //标签云
     $data['linkList'] = Links::orderBy('sequence')->limit(10)->get();
     //友情链接列表
     View::share($data);
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('navigations', function (Blueprint $table) {
         //
         $table->increments('id');
         $table->string('menu');
         $table->string('class');
         $table->string('href');
         $table->string('content');
         $table->string('title')->nullable();
         $table->text('option')->nullable();
         $table->integer('priority')->default(0);
         $table->timestamps();
         $table->timestamp('published')->nullable();
         $table->softDeletes();
     });
     /*****  MAIN MENU  *****/
     Navigation::create(['menu' => 'main', 'href' => '/', 'content' => 'Home', 'title' => 'Acclaim Events Home', 'option' => '', 'priority' => '1', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'main', 'href' => '/about', 'content' => 'About Us', 'option' => '', 'priority' => '2', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'main', 'href' => '/conferences', 'content' => 'Conferences', 'option' => '', 'priority' => '3', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'main', 'href' => '/contact', 'class' => 'register-now', 'content' => 'Contact Us', 'option' => '', 'priority' => '4', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'main', 'class' => 'register-now', 'href' => '/register', 'content' => 'Register', 'option' => '', 'priority' => '5']);
     /*****  HOME SUBMENU  *****/
     Navigation::create(['menu' => 'home', 'href' => '#home', 'content' => 'Top', 'option' => '', 'priority' => '1', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'home', 'href' => '#upcoming-events', 'content' => 'Upcoming Events', 'option' => '', 'priority' => '2', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'home', 'href' => '#benefits', 'content' => 'Who Should Attend', 'option' => '', 'priority' => '3', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'home', 'href' => '#testimonials', 'content' => 'Testimonials', 'option' => '', 'priority' => '4', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     /*****  ABOUT SUBMENU  *****/
     Navigation::create(['menu' => 'about', 'href' => '#about', 'content' => 'About Acclaim', 'option' => '', 'priority' => '1', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'about', 'href' => '#team', 'content' => 'Meet Our Team', 'option' => '', 'priority' => '2', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'about', 'href' => '#advisors', 'content' => 'Advisory Board', 'option' => '', 'priority' => '3', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     /*****  CONFERENCE SUBMENU  *****/
     Navigation::create(['menu' => 'conference', 'href' => '#home', 'content' => 'Top', 'option' => '', 'priority' => '1', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'conference', 'href' => '#countdown', 'content' => 'Countdown', 'option' => 'options:countdown=true', 'priority' => '2', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'conference', 'href' => '#agenda', 'content' => 'Agenda', 'option' => 'options:agenda=true', 'priority' => '3', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'conference', 'href' => '#speakers', 'content' => 'Speakers', 'option' => 'options:speakers=true', 'priority' => '4', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'conference', 'href' => '#sponsors', 'content' => 'Sponsors', 'option' => '', 'priority' => '5', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
     Navigation::create(['menu' => 'conference', 'href' => '#location', 'content' => 'Venue', 'option' => 'options:venue=true', 'priority' => '5', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]);
 }
示例#4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     if ($result = check_auth_to('DHGL_DELETE')) {
         return $result;
     }
     try {
         $count = Navigation::where('parent_id', '=', $id)->count();
         if ($count !== 0) {
             throw new \Exception("请先删除下级导航");
         }
         Navigation::destroy($id);
         return redirect()->action('Admin\\NavigationController@index')->with('operationstatus', 'sucess');
     } catch (\Exception $e) {
         return redirect()->back()->withErrors(['error' => '删除导航失败,请重试(' . $e->getMessage() . ')']);
     }
 }