本文整理汇总了PHP中Menu::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::find方法的具体用法?PHP Menu::find怎么用?PHP Menu::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified resource.
* GET /menus/{id}
*
* @param int $id
* @return Response
*/
public function show($id)
{
$menus = Menu::all();
$menu = Menu::find($id);
// dd($menu);
return View::make('menus.index', compact('menus', 'menu'));
}
示例2: _fetch
/**
* Function which actially fetch the data from the database
* @param object $options
* @return nested array of menu nodes.
*/
private function _fetch($options = array())
{
App::import('Model', 'Cakemenu.Menu');
$menu = new Menu();
if (isset($options['subtree'])) {
$parent = true;
if (isset($options['subtree']['parent'])) {
$parent = $options['subtree']['parent'];
unset($options['subtree']['parent']);
}
$subtree = $menu->find('first', array('conditions' => $options['subtree']));
if ($subtree != false) {
if ($parent == true) {
$conditions = array('Menu.lft >=' => $subtree['Menu']['lft'], 'Menu.rght <=' => $subtree['Menu']['rght']);
} else {
$conditions = array('Menu.lft >' => $subtree['Menu']['lft'], 'Menu.rght <' => $subtree['Menu']['rght']);
}
if (isset($options['conditions'])) {
$options['conditions'] = am($options['conditions'], $conditions);
} else {
$options['conditions'] = $conditions;
}
}
unset($options['subtree']);
}
$nodes = $menu->find('threaded', am(array('order' => 'Menu.lft ASC'), $options));
return $nodes;
}
示例3: getSuccess
/**
* 获取成功的订单
* @return [type] [description]
*/
public function getSuccess()
{
$data = array('main' => url('/'), 'announce' => url('/announce'), 'category' => url('/category'), 'deliver' => url('/deliver'), 'good' => url('/good'), 'map' => url('/map'), 'shop_info' => url('/shop_info'), 'success' => url('/success'), 'widge_success' => array());
$shop_id = Auth::user()->shop_id;
$orders = Order::where('shop_id', $shop_id)->where('state_of_shop', 3)->get();
$data['widge_success']['deal_count'] = count($orders);
$data['widge_success']['deal'] = array();
$shop = Shop::find($shop_id);
foreach ($orders as $order) {
$comment = CommentOrder::where('order_id', $order->id)->get();
$one = array('deal_id' => $order->id, 'deal_statue' => $order->state, 'same_again' => '##', 'deal_again' => '##', 'shop_name' => $shop->name, 'deal_number' => $order->number, 'deal_time' => date('Y-m-d', $order->ordertime), 'deal_phone' => $shop->linktel, 'deliver_address' => $order->receive_address, 'deliver_phone' => $order->receive_phone, 'deliver_remark' => $order->beta, 'deal_speed' => isset($comment[0]) ? $comment[0]->speed : 0, 'deal_satisfied' => isset($comment[0]) ? $comment[0]->value : 0, 'good' => array(), 'others' => array(array('item_name' => '不知道', 'item_value' => '-5', 'item_amount' => '1', 'item_total' => '0')));
$one['total'] = $order->total;
$menu_ids = array_count_values(explode(',', $order->order_menus));
foreach ($menu_ids as $menu_id => $amount) {
$menuComment = CommentMenu::where('order_id', $order->id)->where('menu_id', $menu_id)->get();
$menu = Menu::find($menu_id);
//var_dump($menuComment);
$onemenu = array('goods_id' => $menu_id, 'goods_name' => $menu->title, 'goods_value' => $menu->price, 'goods_amount' => $amount, 'goods_total' => $amount * $menu->price, 'good_atisfied' => isset($menuComment[0]) ? $menuComment[0]->value : 0);
array_push($one['good'], $onemenu);
}
array_push($data['widge_success']['deal'], $one);
}
return View::make("template.success.success")->with($data);
//var_dump($data);
}
示例4: index
/**
* 主界面
*/
public function index()
{
if (Auth::check()) {
$cartkey = Auth::user()->front_uid;
} else {
$cartkey = $this->getIP();
}
$key = 'laravel:user:' . $cartkey . ':cart';
$shop_id = Redis::lrange($key, 0, 0);
$ids = array_count_values(Redis::lrange($key, 1, -1));
$shop = Shop::find($shop_id[0]);
$cart_list = array();
$cart_amount = 0;
// 商品总价格
$i = 0;
foreach ($ids as $id => $amount) {
$good = Menu::find($id);
$cart_list[$i] = array('good_name' => $good->title, 'good_id' => $id, 'good_price' => $good->price, 'good_amount' => $amount, 'good_total' => $good->price * $amount);
$cart_amount += $cart_list[$i]['good_total'];
$i++;
}
$output = array('userbar' => $this->getUserBar(), 'deliver_place' => Session::get('deliver_place'), 'deliver_tel' => Session::get('deliver_tel'), 'deliver_name' => Session::get('deliver_name'), 'deliver_time' => array('08:00', '09:00', '10:12', '12:30'), 'data' => array('user_name' => '注释用户名', 'shop_path' => '', 'shop_id' => $shop->id, 'shop_logo' => $shop->pic, 'shop_name' => $shop->name, 'shop_href' => url('shop/' . $shop->id), 'shop_type' => $shop->type, 'cart_list' => $cart_list, 'cart_amount' => $cart_amount, 'deliver_place' => Session::get('deliver_place'), 'deliver_time' => array('08:00', '09:00', '10:12', '12:30'), 'pay_method' => array('0' => array('is_default' => 0, 'method_name' => '在线支付'))), 'pay_status' => '付款信息');
//var_dump($output);
return View::make("template.order.order")->with($output);
}
示例5: vistaOrdenar
public function vistaOrdenar($menu_id)
{
$menu = Menu::find($menu_id);
$this->array_view['secciones'] = $menu->seccionesConItems();
$this->array_view['menu'] = $menu;
return View::make($this->folder_name . '.lista-por-menu', $this->array_view);
}
示例6: showAction
public function showAction()
{
$post = Post::findFirst();
$this->view->title = $post->title;
$this->view->post = $post;
$this->view->menu = Menu::find();
$this->view->show_navigation = true;
}
示例7: showAction
public function showAction()
{
$post = Post::findFirst();
$this->view->setVar("title", $post->title);
$this->view->setVar("post", $post);
$this->view->setVar("menu", Menu::find());
$this->view->setVar("show_navigation", true);
}
示例8: Order
public function Order($idStand, $idMenu)
{
$bindedMenu = Menu::find($idMenu);
$username = Session::get('user');
$userLoggedIn = User::where('username', $username)->first();
$data = array('bindedMenu' => $bindedMenu, 'user' => $userLoggedIn, 'idStand' => $idStand);
return View::make('order', $data);
}
示例9: post_add
public function post_add()
{
$link = new Link();
$link->name = Input::get('name');
$link->parent = Input::get('parent');
$menu = Menu::find(Input::get('menu_id'));
$menu->links()->insert($link);
return Redirect::to_action('admin.menus@all', array($menu->id))->with('flash', true)->with('flash_type', 'success')->with('flash_msg', 'New link created successfully.');
}
示例10: update
public function update()
{
$input = Request::all();
$menu = Menu::find($input['_id']);
$menu->menu = $input['menu_nombre'];
$menu->url = $input['menu_url'];
$menu->padre_id = $input['menu_padre_id'];
$menu->save();
return view('menu.verMenu')->with('menu', $menu)->with('edited', true);
}
示例11: index_delete
function index_delete()
{
// $data=$this->post();
$post_data = file_get_contents("php://input");
$post_data = json_decode($post_data, true);
var_dump($post_data);
die;
$menu = Menu::find($data['id']);
$menu->active = 0;
$menu->save();
$this->response($menu);
}
示例12: 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');
}
示例13: generatemenucontrol
public function generatemenucontrol()
{
$menu = Menu::find(Input::get("idmenu"));
$menu->name = Input::get("menuname");
$menu->save();
foreach (Input::get("arraydata") as $value) {
$menuitem = MenuItem::find($value["id"]);
$menuitem->parent = $value["parent"];
$menuitem->sort = $value["sort"];
$menuitem->depth = $value["depth"];
$menuitem->save();
}
echo json_encode(array("resp" => 1));
}
示例14: consultaContacto
public function consultaContacto()
{
$data = Input::all();
Input::flashOnly('nombre', 'email', 'telefono', 'consulta');
$reglas = array('email' => array('required', 'email'), 'nombre' => array('required'));
$validator = Validator::make($data, $reglas);
if ($validator->fails()) {
$messages = $validator->messages();
if ($messages->has('nombre')) {
$mensaje = $messages->first('nombre');
} elseif ($messages->has('email')) {
$mensaje = $messages->first('email');
} else {
$mensaje = Lang::get('controllers.cliente.datos_consulta_contacto_incorrectos');
}
return Redirect::to('/contacto')->with('mensaje', $mensaje)->with('error', true)->withInput();
} else {
$this->array_view['data'] = $data;
Mail::send('emails.consulta-contacto', $this->array_view, function ($message) use($data) {
$message->from($data['email'], $data['nombre'])->to('mariasanti38@hotmail.com')->subject('Consulta');
});
if (count(Mail::failures()) > 0) {
$mensaje = Lang::get('controllers.cliente.consulta_no_enviada');
} else {
$data['nombre_apellido'] = $data['nombre'];
Cliente::agregar($data);
$mensaje = Lang::get('controllers.cliente.consulta_enviada');
}
if (isset($data['continue']) && $data['continue'] != "") {
switch ($data['continue']) {
case "contacto":
return Redirect::to('contacto')->with('mensaje', $mensaje);
break;
case "menu":
$menu = Menu::find($data['menu_id']);
return Redirect::to('/' . $menu->url)->with('mensaje', $mensaje);
break;
}
}
return Redirect::to("/")->with('mensaje', $mensaje);
//return View::make('producto.editar', $this->array_view);
}
}
示例15: postEditMenu
public function postEditMenu($id)
{
/* validate input */
$validator = Validator::make(Input::all(), array("menu_date" => "required|date_format:Y-m-d", "dishes" => "required", "recommendation" => "required"));
/* if validated */
if ($validator->passes()) {
/* get input */
$menu = Menu::find($id);
$menu->menu_date = Input::get("menu_date");
$menu->dishes()->sync(Input::get('dishes'));
$menu->save();
$recommendation = Menu::find($id)->recommendation;
$recommendation->recommendation = Input::get("recommendation");
$recommendation->save();
return Redirect::to("admin/menu/edit_menu/{$id}")->with('message', 'Menu edited!');
} else {
return Redirect::to("admin/menu/edit_menu/{$id}")->withErrors($validator);
}
// end validation
}