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


PHP MenuItem::create方法代码示例

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


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

示例1: run

 public function run()
 {
     $array = array(['name' => 'Peluang Bisnis', 'link' => 'peluang', 'order' => '0', 'menu_id' => '1', 'visible' => '1'], ['name' => 'Artikel', 'link' => 'kategori/uncategorized', 'order' => '1', 'menu_id' => '1', 'visible' => '1'], ['name' => 'Syarat & Ketentuan', 'link' => 'pages/syarat-ketentuan', 'order' => '0', 'menu_id' => '2', 'visible' => '1'], ['name' => 'Privacy Policy', 'link' => 'pages/privacy-policy', 'order' => '1', 'menu_id' => '2', 'visible' => '1'], ['name' => 'Disclaimer', 'link' => 'pages/disclaimer', 'order' => '2', 'menu_id' => '2', 'visible' => '1']);
     foreach ($array as $item) {
         MenuItem::create($item);
     }
 }
开发者ID:arbuuuud,项目名称:gnt-aops,代码行数:7,代码来源:MenuItemsTableSeeder.php

示例2: store

 /**
  * Store a newly created resource in storage.
  * POST /menuitems
  *
  * @return Response
  */
 public function store()
 {
     // tergantung tipe menu apa yang ingin disimpan, perilaku setiap tipe berbeda prosesnya
     $type = Input::get('menuitem_type');
     if ($type == 'page') {
         $inputdata = Input::all();
         $menu_id = $inputdata['menu_id'];
         foreach ($inputdata['menuitems'] as $menuitem) {
             if (isset($menuitem['id'])) {
                 $type = $menuitem['type'];
                 $id = $menuitem['id'];
                 // Set the item data based on type, manual code currently for each type. Refer to routes.
                 if ($type == 'page') {
                     $page = Page::find($id);
                     $itemdata['name'] = $page->title;
                     $itemdata['link'] = 'pages/' . $page->slug;
                     $itemdata['menu_id'] = $menu_id;
                 }
                 // Validate and crate the data
                 $validator = Validator::make($itemdata, MenuItem::$rules);
                 if ($validator->fails()) {
                     return Redirect::back()->withErrors($validator)->withInput();
                 }
                 MenuItem::create($itemdata);
             }
         }
     }
     if ($type == 'custom') {
         $validator = Validator::make(Input::all(), MenuItem::$rules);
         if ($validator->fails()) {
             return Redirect::back()->withErrors($validator)->withInput();
         }
         MenuItem::create(Input::except('menuitem_type'));
     }
     return Redirect::route('admin.menus.index')->with("message", "Data berhasil disimpan");
 }
开发者ID:arbuuuud,项目名称:gnt-aops,代码行数:42,代码来源:MenuItemsController.php

示例3: testInsertionToParentFromOtherScope

 public function testInsertionToParentFromOtherScope()
 {
     $node = MenuItem::create(['menu_id' => 2, 'parent_id' => 5]);
 }
开发者ID:nutsdo,项目名称:nong-store,代码行数:4,代码来源:ScopedNodeTest.php

示例4: MenuItem

<?php

ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);
require 'config.php';
require 'models/menu-item.class.php';
$menuItem = new MenuItem();
if (isset($_POST["delete_id"])) {
    $id = $_POST['delete_id'];
    $menuItem->delete($id);
} else {
    if (isset($_POST['id'])) {
        $name = $_POST['name'];
        $description = $_POST['description'];
        $price = $_POST['price'];
        $id = $_POST['id'];
        $menuItem->update($id, $name, $description, $price, 'lunch');
    } else {
        if (isset($_POST['add'])) {
            $name = $_POST['name'];
            $description = $_POST['description'];
            $price = $_POST['price'];
            $menuItem->create($name, $description, $price, 'lunch');
        }
    }
}
开发者ID:psrivongse,项目名称:echizen-php,代码行数:26,代码来源:update-menu-item.php


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