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


PHP Menu::all方法代码示例

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


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

示例1: boot

 public function boot()
 {
     view()->composer('*', function ($view) {
         $menuId = request()->get('menuid');
         $routeName = app('router')->currentRouteName();
         if (empty($menuId)) {
             $menuId = app('menu')->select('id')->where('route', '=', $routeName)->first()['id'];
         }
         $params = ['submenus' => [], 'route_name' => $routeName, 'menuid' => $menuId];
         if (!empty($menuId)) {
             $menus = Menu::all();
             $submenus = [];
             foreach ($menus as $menu) {
                 if ($menu['parentid'] == $menuId) {
                     $submenus[] = $menu;
                 }
                 if ($menu['id'] == $menuId) {
                     $p = $menu;
                 }
             }
             array_unshift($submenus, $p);
             $params['submenus'] = $submenus;
         }
         $view->with($params);
     });
 }
开发者ID:ruolinn,项目名称:lcms,代码行数:26,代码来源:ComposerServiceProvider.php

示例2: getEdit

 public function getEdit($id)
 {
     $weight_list = [];
     $menuitems_count = Menu::all()->count();
     for ($i = 1; $i <= $menuitems_count; $i++) {
         $weight_list[$i] = $i;
     }
     return view('admin.menu.edit', ['weight_list' => $weight_list, 'menuitem' => Menu::find($id), 'url' => config('medias.url')]);
 }
开发者ID:venomir,项目名称:tc,代码行数:9,代码来源:MenuController.php

示例3: getAll

 public function getAll()
 {
     $top = DB::table('toplinks')->get();
     $links = $this->fetchTable(Menu::all());
     $sublinks = $this->getSublinks();
     $title = $this->getTitle('Home');
     $Links = array('titletest' => $title, 'menu' => $links, 'sublinks' => $sublinks, 'toplinks' => $top);
     return $Links;
 }
开发者ID:PontusPd,项目名称:Running-shoes,代码行数:9,代码来源:FlatHeaderRepositories.php

示例4: edit

 public function edit($menuId)
 {
     $menus = Menu::all()->keyBy('id')->toArray();
     $parentId = $menus[$menuId]['parentid'];
     $menus = array_map(function ($menu) use($parentId) {
         $menu['selected'] = $menu['id'] == $parentId ? 'selected' : '';
         return $menu;
     }, $menus);
     $opt = "<option value='\$id' \$selected>\$spacer \$name</option>";
     $select = with(new Tree($menus))->getTree(0, $opt);
     return view('menus.edit', ['menu' => $menus[$menuId], 'select' => $select]);
 }
开发者ID:ruolinn,项目名称:lcms,代码行数:12,代码来源:MenusController.php

示例5: leftMain

 public function leftMain(Request $request)
 {
     $menuId = $request->get('menuid');
     $menus = Menu::all()->toArray();
     $leftMenus = [];
     foreach ($menus as $menu) {
         if ($menu['parentid'] == $menuId) {
             $leftMenus[$menu['id']] = $menu;
         }
         if (isset($leftMenus[$menu['parentid']])) {
             $leftMenus[$menu['parentid']]['child'][] = $menu;
         }
     }
     return view('dash.left_main', ['left_menus' => $leftMenus]);
 }
开发者ID:ruolinn,项目名称:lcms,代码行数:15,代码来源:DashController.php

示例6: get

 public static function get($title, $type)
 {
     $result = DB::table('global_blocks')->where('title', $title)->where('type', $type)->count();
     if ($result == 0) {
         DB::table('global_blocks')->insert(['title' => $title, 'type' => $type]);
     }
     $block = DB::table('global_blocks')->where('title', $title)->where('type', $type)->first();
     $menus = Menu::all();
     foreach ($menus as $row) {
         $pos = strpos($block->content, $row->tag);
         if ($pos !== false) {
             $navbar = new Nav($row->content, $row->type);
             $block->content = str_replace($row->tag, $navbar->get(), $block->content);
         }
     }
     return $block->content;
 }
开发者ID:nova-framework,项目名称:cms,代码行数:17,代码来源:GlobalBlocks.php

示例7: detail

 public function detail($id)
 {
     $page = 'catalog';
     $title = Menu::where('key', $page)->value('name');
     $menuHtml = $this->menuHtml($page);
     $menuItems = Menu::all();
     $bottomMenuHtml = view('bottom', ['menuItems' => $menuItems])->render();
     $pageInfo = Page::where('key', $page)->first();
     $categories = Category::orderBy('sort', 'asc')->get();
     $product = Product::with(['category', 'color'])->find($id);
     $product->increment('views');
     $recommended = Product::with('category')->take(4)->get();
     $smallCart = $this->smallCart();
     $cartItem = $this->cartItem($product->id);
     $page = $product;
     $page->title = $product->name;
     return view('site.product', ['menuHtml' => $menuHtml, 'menuBottomHtml' => $bottomMenuHtml, 'title' => $title, 'page' => $page, 'product' => $product, 'categories' => $categories, 'recommended' => $recommended, 'count' => $smallCart['count'], 'sum' => $smallCart['sum'], 'currentItem' => $cartItem, 'currentProductCategory' => $product->category]);
 }
开发者ID:pechatny,项目名称:kolizej,代码行数:18,代码来源:CatalogController.php

示例8: index

 public function index($page = '')
 {
     //        $title = Menu::where('key', $page)->value('name');
     $categories = Category::orderBy('sort', 'asc')->get();
     $menuHtml = $this->menuHtml($page);
     if (session()->has('cart')) {
         $cartItems = session()->get('cart');
         $sum = $cartItems->sum();
         $count = count($cartItems->all());
     } else {
         $sum = 0;
         $count = 0;
     }
     $menuItems = Menu::all();
     $products = Product::with('category')->orderBy('views', 'desc')->take(8)->get();
     $bottomMenuHtml = view('bottom', ['menuItems' => $menuItems])->render();
     $page = Page::where('key', 'index')->first();
     return view('index', ['menuHtml' => $menuHtml, 'menuBottomHtml' => $bottomMenuHtml, 'categories' => $categories, 'count' => $count, 'sum' => $sum, 'products' => $products, 'indexFlag' => true, 'page' => $page]);
 }
开发者ID:pechatny,项目名称:kolizej,代码行数:19,代码来源:IndexController.php

示例9: search

 public function search(Request $request)
 {
     $page = new \stdClass();
     $page->title = 'Поиск';
     $page->keywords = 'Поиск';
     $page->description = 'Поиск';
     $page->key = 'search';
     $menuHtml = $this->menuHtml('cart');
     $menuItems = Menu::all();
     $bottomMenuHtml = view('bottom', ['menuItems' => $menuItems])->render();
     $categories = Category::orderBy('sort', 'asc')->get();
     $smallCart = $this->smallCart();
     if ($request->has('val')) {
         $products = Product::where('name', 'like', "%{$request->val}%")->orWhere('text', 'like', "%{$request->val}%")->get();
         $val = $request->get('val');
     } else {
         $val = '';
         $products = [];
     }
     return view('site.search', ['menuHtml' => $menuHtml, 'menuBottomHtml' => $bottomMenuHtml, 'page' => $page, 'categories' => $categories, 'products' => $products, 'count' => $smallCart['count'], 'sum' => $smallCart['sum'], 'indexFlag' => true, 'search' => $val]);
 }
开发者ID:pechatny,项目名称:kolizej,代码行数:21,代码来源:PagesController.php

示例10: index

 public function index(Request $request)
 {
     $page = new \stdClass();
     $page->title = 'Корзина';
     $page->keywords = 'Корзина';
     $page->description = 'Корзина';
     $page->key = 'cart';
     //        $title = Menu::where('key', 'cart')->value('name');
     $menuHtml = $this->menuHtml('cart');
     $menuItems = Menu::all();
     $bottomMenuHtml = view('bottom', ['menuItems' => $menuItems])->render();
     //        $page = Page::where('key', $page)->first();
     $cart = $request->session()->get('cart');
     if ($cart) {
         $items = $cart->all();
     } else {
         $items = false;
     }
     $categories = Category::orderBy('sort', 'asc')->get();
     $smallCart = $this->smallCart();
     return view('site.cart', ['menuHtml' => $menuHtml, 'menuBottomHtml' => $bottomMenuHtml, 'page' => $page, 'items' => $items, 'categories' => $categories, 'count' => $smallCart['count'], 'sum' => $smallCart['sum'], 'deliverySum' => $smallCart['deliverySum'], 'totalSum' => $smallCart['deliverySum'] + $smallCart['sum']]);
 }
开发者ID:pechatny,项目名称:kolizej,代码行数:22,代码来源:CartController.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $menus = Menu::all();
     return view($this->getManageView('index'))->withMenus($menus);
 }
开发者ID:chictem,项目名称:chictem,代码行数:10,代码来源:MenuController.php

示例12: paypal_cancel

 public function paypal_cancel()
 {
     return View('Runningshoes/pages/paypalCancel')->with(array('title' => $this->getTitle('Home'), 'links' => $this->fetchTable(Menu::all()), 'topLinks' => $this->fetchTable(DB::table('toplinks')->get())));
 }
开发者ID:PontusPd,项目名称:Running-shoes,代码行数:4,代码来源:PaymentController.php

示例13: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $menu = \App\Models\Menu::all();
     return view('menu', ['menu' => $menu, "title" => "Our Menu"]);
 }
开发者ID:skalata90,项目名称:bellamilano,代码行数:11,代码来源:MenusController.php

示例14: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $menuItems = Menu::all();
     $data = ['route' => 'menu', 'title' => Menu::$tableName, 'menuItems' => $menuItems, 'menuNames' => Menu::$fields];
     return view('admin.menu.menuList', $data);
 }
开发者ID:pechatny,项目名称:kolizej,代码行数:11,代码来源:MenuController.php


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