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


PHP Menu::count方法代码示例

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


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

示例1: 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

示例2: uploadMenu

 public function uploadMenu(Request $request)
 {
     $data = $this->postUpload($request);
     if (is_array($data)) {
         $before = Menu::count();
         foreach ($data as $item) {
             Menu::updateOrCreate(['number' => $item['number']], ['number' => $item['number'], 'title' => $item['title'], 'price' => $item['price']]);
         }
         $difference = Menu::count() - $before;
         Helper::add('', 'uploaded menu items import file');
         if ($difference > 0) {
             Session::flash('flash_message', $difference . ' ' . $this->title . ' items successfully imported!');
         } else {
             Session::flash('flash_message', 'No new ' . $this->title . ' items imported!');
         }
         return Redirect::action('MenusController@index');
     } else {
         return $data;
     }
 }
开发者ID:spwin,项目名称:controlmystock,代码行数:20,代码来源:MenusController.php

示例3: uploadMenu

 public function uploadMenu(Request $request)
 {
     $data = $this->postUpload($request);
     if (is_array($data)) {
         $before = Menu::count();
         $sale = Sales::create(['stock_period_id' => $request->get('stock_period_id')]);
         foreach ($data as $item) {
             $menu = Menu::updateOrCreate(['number' => $item['number']], ['number' => $item['number'], 'title' => $item['title'], 'price' => $item['price']]);
             $data = ['quantity' => $item['quantity'], 'menu_id' => $menu->id, 'sale_id' => $sale->id, 'price' => $item['price'], 'total_price' => round($item['price'] * $item['quantity'], 2)];
             SaleItems::create($data);
         }
         $difference = Menu::count() - $before;
         Helper::add('', 'uploaded ' . $difference . ' menu items import file on import sales action');
         Session::flash('flash_message', 'Sale uploaded successfully with ' . $difference . ' new items added to menu.');
         return Redirect::action('SalesController@index', ['stock_period' => $request->get('stock_period_id')]);
     } else {
         return $data;
     }
 }
开发者ID:spwin,项目名称:controlmystock,代码行数:19,代码来源:SalesController.php


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