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


PHP Menu::where方法代码示例

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


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

示例1: hasChildItems

 /**
  * @param $id
  *
  * @return bool
  */
 public function hasChildItems($id)
 {
     $count = $this->menu->where('parent_id', $id)->where('is_published', 1)->where('lang', $this->getLang())->get()->count();
     if ($count === 0) {
         return false;
     }
     return true;
 }
开发者ID:noikiy,项目名称:fullycms,代码行数:13,代码来源:MenuRepository.php

示例2: index

 function index()
 {
     $menus = new Menu();
     if (@$_GET['status']) {
         $menus->where('status', $_GET['status']);
     }
     $data['menus'] = $menus->order_by('orderlist', 'asc')->get_page(limit());
     $this->template->append_metadata(js_checkbox('approve'));
     $this->template->build('admin/menu_index', $data);
 }
开发者ID:unisexx,项目名称:thaigcd2015,代码行数:10,代码来源:menus.php

示例3: destroy

 public function destroy($id)
 {
     Menu::destroy($id);
     $child_menu_items = Menu::where('parent_id', '=', $id)->get();
     foreach ($child_menu_items as $menu_items) {
         $menu_items->parent_id = NULL;
         $menu_items->save();
     }
     return Redirect::to('admin/menu')->with(array('note' => 'Successfully Deleted Menu Item', 'note_type' => 'success'));
 }
开发者ID:rinodung,项目名称:hello-video-laravel,代码行数:10,代码来源:AdminMenuController.php

示例4: menuReorder

 public function menuReorder()
 {
     $ajax = Request::ajax();
     $arrPost = Input::all();
     unset($arrPost['_token']);
     $updated = false;
     if (!empty($arrPost)) {
         $frontend = Permission::can($this->layout->admin, 'menusfrontend_edit_all');
         $backend = Permission::can($this->layout->admin, 'menusbackend_edit_all');
         foreach ($arrPost as $type => $menu) {
             if (empty($menu)) {
                 continue;
             }
             if ($type == 'backend' && !$backend) {
                 continue;
             } else {
                 if (in_array($type, ['header', 'footer']) && !$frontend) {
                     continue;
                 }
             }
             $menu = json_decode($menu);
             foreach ($menu as $key => $value) {
                 $i = 1;
                 Menu::where('id', $value->id)->update(['parent_id' => 0, 'order_no' => $key + 1, 'level' => $i]);
                 if (isset($value->children)) {
                     Menu::updateRecursiveChildOrder($value->children, $value->id, $i + 1);
                 }
             }
             $updated = true;
         }
         if ($updated) {
             Menu::clearCache();
         }
         if ($ajax) {
             if ($updated) {
                 $sidebar = Menu::get(["sidebar" => true]);
                 $arrParent = Menu::getCache(['parent' => true]);
                 $arrReturn = ['status' => 'ok', 'sidebar' => $sidebar, 'parent' => $arrParent];
             } else {
                 $arrReturn = ['status' => 'warning', 'message' => 'Nothing was changed.'];
             }
             $response = Response::json($arrReturn);
             $response->header('Content-Type', 'application/json');
             return $response;
         }
         return Redirect::to(URL . '/admin/menus')->with(['flash_success' => $updated ? 'Menu has been re-ordered.' : 'Nothing was change.']);
     }
     if ($ajax) {
         $response = Response::json(['status' => 'error', 'message' => 'We found nothing to re-order. Please check again.']);
         $response->header('Content-Type', 'application/json');
         return $response;
     }
     return Redirect::to(URL . '/admin/menus');
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:54,代码来源:MenusController.php

示例5: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
     $school = School::findOrFail($id);
     $validator = Validator::make($data = Input::all(), School::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $school->update($data);
     return Redirect::route('user.profile.index')->with("successMessage", "Data Sekolah Berhasil di Update")->withTitle('Profile');
 }
开发者ID:inseo201,项目名称:atletik4,代码行数:17,代码来源:ProfileController.php

示例6: postDelete

 public function postDelete()
 {
     $id = Input::get('delete_id');
     // Find all items with the parent_id of this one and reset the parent_id to zero
     $items = Menu::where('parent_id', $id)->get()->each(function ($item) {
         $item->parent_id = 0;
         $item->save();
     });
     // Find and delete the item that the user requested to be deleted
     $item = Menu::find($id);
     $item->delete();
     return Redirect::to('admin/menu');
 }
开发者ID:basuritas-laravel,项目名称:laravel-shop-menu,代码行数:13,代码来源:MenuController.php

示例7: create

 /**
  * Show the form for creating a new payment
  *
  * @return Response
  */
 public function create()
 {
     $tgl = new DateTime(date('Y-m-d'));
     $limit = Setting::first();
     $limitdtend = new DateTime($limit->enddaypay);
     $limitend = $limitdtend->diff($tgl)->format('%R%a');
     $menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
     $jstotal = Session::get('jstotal');
     if ($limitend > 0) {
         return Redirect::to('user/cost')->with('errorMessage', trans('Pembayaran Sudah Ditutup.'));
     }
     return View::make('payments.create')->withTitle('Payment')->with('menu', $menu)->with('jstotal', $jstotal);
 }
开发者ID:inseo201,项目名称:atletik4,代码行数:18,代码来源:PaymentsController.php

示例8: edit_post

 public function edit_post($id)
 {
     $valid = Validator::make(Input::all(), Order::$rule_edit_order, Order::$order_langs);
     if ($valid->passes()) {
         $user = User::where("username", Input::get("username"))->first();
         if (count($user) == 0) {
             return Redirect::route("manage_order_edit_get", $id)->withInput()->with("flash_error", "Người dùng có tên đăng nhập " . Input::get("username") . " là không tồn tại");
         }
         $menu = Menu::where("menu_name", Input::get("menu_name"))->first();
         if (count($menu) == 0) {
             return Redirect::route("manage_order_edit_get", $id)->withInput()->with("flash_error", "Thực đơn có tên " . Input::get("menu_name") . " là không tồn tại");
         }
         $data = array("user_id" => $user->id, "menu_id" => $menu->menu_id, "order_date" => Input::get("order_date"));
         DB::table("orders")->where("order_id", $id)->update($data);
         return Redirect::route("manage_order")->with("flash_success", "Chúc mừng bạn đã sửa yêu cầu thực đơn thành công");
     }
     return Redirect::route("manage_order_edit_get", $id)->withInput()->with("flash_error", $valid->errors()->first());
 }
开发者ID:quanit94,项目名称:ABCKitchen,代码行数:18,代码来源:OrderController.php

示例9: run

 public function run()
 {
     $admin = Role::where('name', '=', 'admin')->firstOrFail();
     $guest = Role::where('name', '=', 'guest')->firstOrFail();
     $user = Role::where('name', '=', 'user')->firstOrFail();
     $master = Role::where('name', '=', 'master')->firstOrFail();
     Menu::create(['name' => 'home', 'description' => 'show the principal page', 'image' => '', 'title' => 'Home', 'route' => '/']);
     Menu::create(['name' => 'profile', 'description' => 'provide a page to change the user profile', 'image' => '', 'title' => 'Profile', 'route' => 'profile']);
     Menu::create(['name' => 'login', 'description' => 'provide a page to make a login or sign up', 'image' => '', 'title' => 'Login', 'route' => 'login']);
     Menu::create(['name' => 'logout', 'description' => 'make a logout if a user is login', 'image' => '', 'title' => 'Logout', 'route' => 'logout']);
     $login = Menu::where('name', '=', 'login')->firstOrFail();
     $profile = Menu::where('name', '=', 'profile')->firstOrFail();
     $home = Menu::where('name', '=', 'home')->firstOrFail();
     $logout = Menu::where('name', '=', 'logout')->firstOrFail();
     $login->roles()->attach($guest->id);
     $profile->roles()->sync(array($admin->id, $user->id, $master->id));
     $home->roles()->sync(array($guest->id, $admin->id, $user->id, $master->id));
     $logout->roles()->sync(array($admin->id, $user->id, $master->id));
 }
开发者ID:elioth010,项目名称:carretilla_online,代码行数:19,代码来源:DatabaseSeeder.php

示例10: doOrder

 public function doOrder()
 {
     $order = new Transaksi();
     $order->username = Input::get('username');
     $order->tglTransaksi = Input::get('date');
     $order->location = Input::get('address');
     $order->menuname = Input::get('menu');
     $order->jumlahBeli = Input::get('amountOrder');
     $order->idStand = Input::get('idStand');
     $order->statustransaksi = Input::get('status');
     $order->hargaTotal = Input::get('harga') * $order->jumlahBeli;
     $order->save();
     // kurangi saldo user, kurangi stok
     $menuDeliver = Menu::where('name', $order->menuname)->first();
     $menuDeliver->stock = $menuDeliver->stock - $order->jumlahBeli;
     $userOrder = User::where('username', Session::get('user'))->first();
     $userOrder->saldo = $userOrder->saldo - $order->hargaTotal;
     $menuDeliver->save();
     $userOrder->save();
     return Redirect::to('user/admin');
 }
开发者ID:satrioadityo,项目名称:Telmop,代码行数:21,代码来源:TransaksiController.php

示例11: url

		<div class="row">
			<div class="col-lg-12" style="margin-right:30px; margin-left:30px;">
				<div class="col-lg-6">
					<h1>My Menu</h1>
					<div class="table-responsive">
						<table class="table	">
							<thead>
								<tr>
									<th>Menu</th>
									<th>Price</th>
									<th>Status</th>
									<th>Action</th>
								</tr>
							</thead>
							<?php 
$results = Menu::where('idStand', $standLoggedIn->idStand)->get();
?>
							<tbody>
							@foreach($results as $result)
								<tr>
									<td>{{$result->name}}</td>
									<td>{{$result->price}}</td>
									@if($result->stock >0)
										<td>available</td>
									@else
										<td>not available</td>
									@endif
									<td><a class="btn btn-warning" href="{{ url() }}/vendor-admin/myMenu/{{$result->idMenu}}">Edit</a>
									<a class="btn btn-danger" href="" data-toggle="modal" data-target="#myModal{{$result->idMenu}}">Delete</a></td>
									
									<!-- modal confirm -->
开发者ID:satrioadityo,项目名称:Telmop,代码行数:31,代码来源:my-menu.blade.php

示例12: edit

 /**
  * Show the form for editing the specified contest.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
     $contest = Contest::find(Crypt::decrypt($id));
     return View::make('contests.edit', compact('contest'))->withTitle('Ubah')->with('menu', $menu);
 }
开发者ID:inseo201,项目名称:atletik4,代码行数:12,代码来源:ContestsController.php

示例13: getMenus

 /**
  * 获取某个店铺的菜单
  *
  * 对应API:
  * 请求类型:POST
  * @return array 该店铺的菜单(分了类的)
  */
 public function getMenus()
 {
     $shop_id = 1;
     $result = array();
     // 最终结果
     $classify = self::getClassify($shop_id);
     // 获取分类的数组
     $result['class_num'] = count($classify);
     // 分类数量
     $menus = array();
     foreach ($classify as $class_id => $class_name) {
         $one_class = array();
         $one_class['name'] = $class_name;
         $one_class['menu'] = Menu::where('group_id', $class_id)->select('id', 'title', 'price', 'pic', 'sold_month', 'state', 'comment_score', 'comment_num')->get();
         array_push($menus, $one_class);
     }
     $result['menus'] = $menus;
     return $result;
 }
开发者ID:uwitec,项目名称:haochigo_business,代码行数:26,代码来源:ShopController.php

示例14: deleteCategory

 public function deleteCategory($id)
 {
     $category = Category::find($id);
     if (!$category) {
         return Redirect::back()->withErrors('Could not find category');
     }
     $menu = Menu::where('scat', '=', $category->name)->delete();
     $category->delete();
     return Redirect::back();
 }
开发者ID:jmramos02,项目名称:catering,代码行数:10,代码来源:AdminController.php

示例15: postEditMenu

 public function postEditMenu($date = null)
 {
     if (!isset($date) or is_null($date)) {
         return Redirect::to('/admin/menu');
     }
     $menu = Menu::where('menu_date', $date)->first();
     if (is_null($menu)) {
         $menu = new Menu();
     }
     $menu->menu_date = $date;
     $menu->save();
     $menu->dishes()->sync(Input::get('dishes'));
     return Redirect::to('admin/menu/edit/' . $date)->with('message', "Successfully edited menu!");
 }
开发者ID:hlmasterchief,项目名称:lacrestaurant,代码行数:14,代码来源:AdminController.php


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