/**
  * 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');
     });
 }
Ejemplo n.º 2
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() . ')']);
     }
 }