本文整理汇总了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);
});
}
示例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')]);
}
示例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;
}
示例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]);
}
示例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]);
}
示例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;
}
示例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]);
}
示例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]);
}
示例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]);
}
示例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']]);
}
示例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);
}
示例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())));
}
示例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"]);
}
示例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);
}