当前位置: 首页>>代码示例>>PHP>>正文


PHP Menu::save方法代码示例

本文整理汇总了PHP中app\models\Menu::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::save方法的具体用法?PHP Menu::save怎么用?PHP Menu::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Menu的用法示例。


在下文中一共展示了Menu::save方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $menu = new Menu();
     $menu->event_id = 1;
     $menu->menu_name = "Test Menu";
     $menu->save();
 }
开发者ID:rob-meh,项目名称:table-seater,代码行数:12,代码来源:MenuSeeder.php

示例2: store

 public function store(MenuRequest $request)
 {
     $input = $request->all();
     $data = new Menu($input);
     if ($data->save()) {
         return response()->json(array('success' => TRUE));
     }
 }
开发者ID:brutalcrozt,项目名称:SI-Sekolah-L5,代码行数:8,代码来源:MenuController.php

示例3: actionCreate

 /**
  * Creates a new Menu model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Menu();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:altairsoft,项目名称:plutos,代码行数:14,代码来源:MenuController.php

示例4: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Menu();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     return $this->render('create', array('model' => $model));
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:14,代码来源:MenuController.php

示例5: actionCreate

 public function actionCreate()
 {
     \Yii::$app->language = 'vi-VN';
     $model = new Menu();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['list']);
     } else {
         $model->status = Menu::STATUS_ENABLED;
         $model->url = '#';
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:phucnv206,项目名称:pharma,代码行数:12,代码来源:MenuController.php

示例6: postCreate

 public function postCreate()
 {
     $validator = Validator::make(Input::all(), Menu::$rules);
     if ($validator->passes()) {
         $menu = new Menu();
         $menu->title = Input::get('title');
         $menu->url = Input::get('url');
         $menu->weight = Menu::count();
         $menu->save();
         return Redirect::back()->with('message', "Элемент меню добавлен");
     }
     return Redirect::back()->with('message', "Ошибка");
 }
开发者ID:venomir,项目名称:tc,代码行数:13,代码来源:MenuController.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['key' => 'required|unique:menu|max:255', 'name' => 'required', 'sort' => 'required|integer']);
     if ($validator->fails()) {
         return redirect('admin/menu/create')->withErrors($validator)->withInput();
     }
     $menu = new Menu();
     $menu->key = $request->key;
     $menu->name = $request->name;
     $menu->sort = $request->sort;
     $menu->save();
     return redirect('admin/menu');
 }
开发者ID:pechatny,项目名称:kolizej,代码行数:19,代码来源:MenuController.php

示例8: actionCreate

 /**
  * Creates a new Menu model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Menu();
     try {
         if ($model->load($_POST) && $model->save()) {
             return $this->redirect(Url::previous());
         } elseif (!\Yii::$app->request->isPost) {
             $model->load($_GET);
         }
     } catch (\Exception $e) {
         $msg = isset($e->errorInfo[2]) ? $e->errorInfo[2] : $e->getMessage();
         $model->addError('_exception', $msg);
     }
     return $this->render('create', ['model' => $model]);
 }
开发者ID:febfeb,项目名称:yii2-basic-ready,代码行数:20,代码来源:MenuController.php

示例9: store

 public function store()
 {
     $input = Input::only('title', 'type');
     $validate = $this->validate($input);
     if ($validate->passes()) {
         $tag = Str::slug($input['title']);
         //save
         $menu = new Menu();
         $menu->title = $input['title'];
         $menu->type = $input['type'];
         $menu->tag = "[{$tag}]";
         $menu->save();
         return Redirect::to('admin/menus')->withStatus('Menu Created');
     }
     return Redirect::back()->withStatus($validate->errors(), 'danger')->withInput();
 }
开发者ID:nova-framework,项目名称:cms,代码行数:16,代码来源:Menus.php

示例10: actionAdminList

 function actionAdminList()
 {
     $query = new Query();
     $query->addSelect('c.*')->from([Menu::tableName() . ' c']);
     $provider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 100]]);
     $model = new MenuForm();
     if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
         $object = new Menu();
         $object->name = $model->name;
         $object->url = $model->url;
         $object->sort_int = 0;
         $object->active = 1;
         $object->parent_id = 0;
         $object->save();
         $model->command_reload_page = 1;
         //return $this->redirect(Url::toRoute(['posts/menu-list']));
     }
     $this->layout = 'admin';
     return $this->render('//admin/menu/list.php', ['provider' => $provider, 'model' => $model]);
 }
开发者ID:hysdop,项目名称:YobaCMS,代码行数:20,代码来源:MenuControllerOFF.php

示例11: savePost

 /**
  * savePost.
  *
  * @param App\Models\Menu $menu  菜单
  * @param array           $input input
  *
  * @return App\Models\Menu
  */
 public function savePost($menu, $input)
 {
     $menu->fill($input);
     $menu->save();
     return $menu;
 }
开发者ID:renyang9876,项目名称:viease,代码行数:14,代码来源:MenuRepository.php

示例12: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $admin = Role::byLabel('admin')->first();
     $widyaiswara = Role::byLabel('widyaiswara')->first();
     $guru = Role::byLabel('guru')->first();
     $evaluator = Role::byLabel('evaluator')->first();
     $stakeholder = Role::byLabel('stakeholder')->first();
     $menu = new Menu();
     $menu->id = "01";
     $menu->label = "Dashboard";
     $menu->link = "/";
     $menu->icon = "si si-speedometer";
     $menu->position = 1;
     $menu->privileges = json_encode(['ACCESS']);
     $menu->save();
     $admin->menus()->attach("01", ['privileges' => 'ACCESS']);
     $widyaiswara->menus()->attach("01", ['privileges' => 'ACCESS']);
     $guru->menus()->attach("01", ['privileges' => 'ACCESS']);
     $evaluator->menus()->attach("01", ['privileges' => 'ACCESS']);
     $stakeholder->menus()->attach("01", ['privileges' => 'ACCESS']);
     /* Master */
     $menu = new Menu();
     $menu->id = "02";
     $menu->label = "Data Master";
     $menu->link = "#";
     $menu->icon = "si si-bulb";
     $menu->position = 2;
     $menu->privileges = json_encode(['ACCESS']);
     $menu->save();
     $admin->menus()->attach("02", ['privileges' => 'ACCESS']);
     $menu = new Menu();
     $menu->id = "0205";
     $menu->label = "Wilayah Geografis";
     $menu->link = "#";
     $menu->icon = "si si-globe";
     $menu->position = 1;
     $menu->parent_id = "02";
     $menu->privileges = json_encode(['ACCESS']);
     $menu->save();
     $admin->menus()->attach("0205", ['privileges' => 'ACCESS']);
     $menu = new Menu();
     $menu->id = "020501";
     $menu->label = "Provinsi";
     $menu->link = "/master/geografis/provinsi";
     $menu->position = 1;
     $menu->parent_id = "0205";
     $menu->privileges = json_encode(['ACCESS', 'ADD', 'EDIT', 'DELETE']);
     $menu->save();
     $admin->menus()->attach("020501", ['privileges' => 'ACCESS,ADD,EDIT,DELETE']);
     $menu = new Menu();
     $menu->id = "020502";
     $menu->label = "Kota & Kabupaten";
     $menu->link = "/master/geografis/kota";
     $menu->position = 1;
     $menu->parent_id = "0205";
     $menu->privileges = json_encode(['ACCESS', 'ADD', 'EDIT', 'DELETE']);
     $menu->save();
     $admin->menus()->attach("020502", ['privileges' => 'ACCESS,ADD,EDIT,DELETE']);
     // $menu = new Menu;
     // $menu->id = "020503";
     // $menu->label = "Kecamatan";
     // $menu->link = "/master/geografis/kecamatan";
     // $menu->position = 1;
     // $menu->parent_id = "0205";
     // $menu->privileges = json_encode(['ACCESS','ADD','EDIT','DELETE']);
     // $menu->save();
     // $admin->menus()->attach("020503", ['privileges' => 'ACCESS,ADD,EDIT,DELETE']);
     $menu = new Menu();
     $menu->id = "0201";
     $menu->label = "Program Diklat";
     $menu->link = "/master/diklat";
     $menu->icon = "si si-badge";
     $menu->position = 1;
     $menu->parent_id = "02";
     $menu->privileges = json_encode(['ACCESS', 'ADD', 'DELETE', 'EDIT']);
     $menu->save();
     $admin->menus()->attach("0201", ['privileges' => 'ACCESS,ADD,EDIT,DELETE']);
     $menu = new Menu();
     $menu->id = "0202";
     $menu->label = "Periode & Gelombang";
     $menu->link = "#";
     $menu->icon = "si si-clock";
     $menu->position = 2;
     $menu->parent_id = "02";
     $menu->privileges = json_encode(['ACCESS']);
     $menu->save();
     $admin->menus()->attach("0202", ['privileges' => 'ACCESS']);
     $menu = new Menu();
     $menu->id = "020201";
     $menu->label = "Periode";
     $menu->link = "/master/periode";
     $menu->position = 1;
     $menu->parent_id = "0202";
     $menu->privileges = json_encode(['ACCESS', 'ADD', 'DELETE', 'EDIT']);
     $menu->save();
//.........这里部分代码省略.........
开发者ID:miarizkim,项目名称:simonev,代码行数:101,代码来源:MenuTableSeeder.php


注:本文中的app\models\Menu::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。