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


PHP Shop::find方法代码示例

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


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

示例1: 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);
 }
开发者ID:andycall,项目名称:haochigou,代码行数:28,代码来源:CheckoutController.php

示例2: prepareMailData

 protected function prepareMailData()
 {
     $product = Tree::find($this->getPreparedItem('id_catalog'));
     $occupation = Occupation::find($this->getPreparedItem('id_occupation'));
     $this->setMessageSubject('Заявка на услугу: ' . $product->title_ru);
     $this->appendMessageBody("<html><body>");
     $this->appendMessageBody("<p><b>Заявка на услугу:</b> " . $product->title_ru . "</p>");
     $this->appendMessageBody("<p><b>Фамилия:</b> " . $this->getPreparedItem('last_name') . "</p>");
     $this->appendMessageBody("<p><b>Имя:</b> " . $this->getPreparedItem('first_name') . "</p>");
     $this->appendMessageBody("<p><b>Отчество:</b> " . $this->getPreparedItem('patronymic_name') . "</p>");
     $this->appendMessageBody("<p><b>Занятость:</b> " . $occupation->title_ru . "</p>");
     $this->appendMessageBody("<p><b>Email:</b> " . $this->getPreparedItem('email') . "</p>");
     $this->appendMessageBody("<p><b>Контактный телефон:</b> " . $this->getPreparedItem('phone_number') . "</p>");
     $this->appendMessageBody("<p><b>Паспорт:</b> " . $this->getPreparedItem('passport') . "</p>");
     $this->appendMessageBody("<p><b>ИНН:</b> " . $this->getPreparedItem('inn') . "</p>");
     $this->appendMessageBody("<p><b>Клиент банка:</b> " . ($this->getPreparedItem('is_bank_client') ? 'Да' : 'Нет') . "</p>");
     if ($this->getPreparedItem('id_city')) {
         $city = City::find($this->getPreparedItem('id_city'));
         if (isset($city->title_ru)) {
             $this->appendMessageBody("<p><b>Город:</b> " . $city->title_ru . "</p>");
         }
     }
     if ($this->getPreparedItem('id_shop')) {
         $shop = Shop::find($this->getPreparedItem('id_shop'));
         if (isset($shop->title_ru)) {
             $this->appendMessageBody("<p><b>Магазин:</b> " . $shop->title_ru . "</p>");
         }
     }
     if ($this->getPreparedItem('id_product_type')) {
         $productType = Product::find($this->getPreparedItem('id_product_type'));
         if (isset($productType->title_ru)) {
             $this->appendMessageBody("<p><b>Тип товара:</b> " . $productType->title_ru . "</p>");
         }
     }
     if ($this->getPreparedItem('product_price')) {
         $this->appendMessageBody("<p><b>Стоимость товара:</b> " . $this->getPreparedItem('product_price') . "</p>");
     }
     if ($this->getPreparedItem('term')) {
         $this->appendMessageBody("<p><b>Срок кредита:</b> " . $this->getPreparedItem('term') . "</p>");
     }
     if ($this->getPreparedItem('is_insurance_loss_job')) {
         $this->appendMessageBody("<p><b>Страховка от временной потери работы:</b> Да</p>");
     }
     if ($this->getPreparedItem('is_insurance_accident')) {
         $this->appendMessageBody("<p><b>Страховка от несчастного случая:</b> Да</p>");
     }
     $this->appendMessageBody("<html><body>");
 }
开发者ID:OlesKashchenko,项目名称:SkillsProject1,代码行数:48,代码来源:ApplyFormPrivatesConsumer.php

示例3: index

 public function index()
 {
     /* Employee selected by clicking radio button */
     /* ! Remember to clear Input if this is redirected from delete !*/
     $selectedEmployee = new Employee();
     if (Input::has('selectedEmployee')) {
         $selectedEmployee = Employee::find(Input::get('selectedEmployee'));
     }
     $selectedCategory = new Category();
     if (Input::has('selectedCategory')) {
         $selectedCategory = Category::find(Input::get('selectedCategory'));
     }
     $selectedShop = new Shop();
     if (Input::has('selectedShop')) {
         $selectedShop = Shop::find(Input::get('selectedShop'));
     }
     $employees = Employee::all();
     $categories = Category::all();
     $shops = Shop::all();
     $item = new Item();
     return View::make('employees.index', compact('employees', 'item', 'categories', 'shops', 'selectedEmployee', 'selectedCategory', 'selectedShop'));
 }
开发者ID:noikiy,项目名称:posco-laravel-server,代码行数:22,代码来源:EmployeesController.php

示例4: getComment

 /**
  * 获取商家的评论统计信息,在店铺页面指着店铺名称时所显示的那些信息、
  *
  * 对应API:shop/blace/output/data
  * @param integer $sid 店铺ID
  * @return array 包含那些信息的ajax数据
  */
 public function getComment($sid)
 {
     $result = array();
     $s_info = Shop::find($sid);
     $result['shop_id'] = $s_info->id;
     $result['place_id'] = '123';
     // ------------------
     $result['shop_logo'] = $s_info->pic;
     $result['shop_name'] = $s_info->name;
     $result['shop_type'] = $s_info->type;
     // 计算各种比例是有一点麻烦。。。
     // shop表的id join 菜单表的id和shop_id join 评论表的menu_id和value,然后计算value在各个段的平均值。。。
     $hehe = CommentMenu::join('menu', 'comment.menu_id', '=', 'menu.id')->select('comment.value')->where('menu.shop_id', '=', $sid);
     $total = count($hehe->get());
     // 由于没有设置查询缓存,也只能这样子计算了
     $min_5 = count($hehe->whereBetween('value', array(0.0, 5.0))->get());
     $min_4 = count($hehe->whereBetween('value', array(0.0, 4.0))->get());
     $min_3 = count($hehe->whereBetween('value', array(0.0, 3.0))->get());
     $min_2 = count($hehe->whereBetween('value', array(0.0, 2.0))->get());
     $min_1 = count($hehe->whereBetween('value', array(0.0, 1.0))->get());
     $percent_1 = $min_1 / $total;
     $percent_2 = ($min_2 - $min_1) / $total;
     $percent_3 = ($min_3 - $min_2) / $total;
     $percent_4 = ($min_4 - $min_3) / $total;
     $percent_5 = ($min_5 - $min_4) / $total;
     $result['shop_level'] = '';
     $result['shop_total'] = '';
     $result['comment_count'] = '';
     $result['shop_statement'] = '';
     $result['shop_time'] = '';
     $result['shop_address'] = '';
     $result['deliver_begin'] = '';
     $result['shop_distance'] = '';
     $result['price_begin'] = '';
     $result['is_collected'] = '';
     return '------------------------------';
     //return $result;
 }
开发者ID:uwitec,项目名称:haochigo_business,代码行数:45,代码来源:ShopController.php

示例5: getSoldNum

 /**
  * 获取每件商品名称以及其对应的销量
  * @return 键值对
  */
 public function getSoldNum($shop_id)
 {
     $menus = Shop::find($shop_id)->menus;
     $soldNum = array();
     foreach ($menus as $menu) {
         $soldNum[$menu->title] = $menu->sold_num;
     }
     //var_dump($soldNum);
     return $soldNum;
 }
开发者ID:andycall,项目名称:map_admin_RD,代码行数:14,代码来源:HomeController.php

示例6: Uncomment

 /**
  * 未评论页面
  */
 public function Uncomment()
 {
     $orders = Order::where('state', 4)->get();
     $data['userbar'] = $this->userBar();
     $data['sidebar'] = $this->sideBar();
     $data['uncomment']['deal_count'] = count($orders);
     $data['uncomment']['deal'] = array();
     foreach ($orders as $order) {
         $shop = Shop::find($order->shop_id);
         $one = array();
         $one['shop_id'] = $order->shop_id;
         $one['deal_id'] = $order->id;
         $one['deal_statue'] = $order->state;
         $one['same_again'] = '##';
         $one['deal_is_return'] = '##';
         // 是否能退单
         $one['deal_return'] = '##';
         // 退单链接
         $one['deal_is_pre'] = $order->is_pre;
         // 是否是预定单
         $one['deal_pre_time'] = $order->arrivetime;
         // 送餐时间
         $one['deal_again'] = '##';
         // 商品的地址
         $one['shop_name'] = $shop->name;
         // 商店的名称
         $one['deal_number'] = $order->id;
         // 订单号,先用订单ID代替
         $one['deal_time'] = $order->ordertime;
         //订单时间
         $one['deal_phone'] = $shop->linktel;
         //餐厅电话
         $one['deliver_address'] = $order->receive_address;
         //订单送往地址
         $one['deliver_phone'] = $order->receive_phone;
         $one['deliver_remark'] = $order->beta;
         //订单备注
         $one['deal_speed'] = 0;
         // 送餐速度,0没有评价1不满意2一般般3满意
         $one['deal_satisfied'] = '';
         $one['good'] = array();
         $menus = array_count_values(explode(',', $order->order_menus));
         foreach ($menus as $menu_id => $count) {
             $good = Menu::find($menu_id);
             array_push($one['good'], array('goods_id' => $good->id, 'goods_name' => $good->title, 'goods_value' => $good->price, 'goods_amount' => $count, 'goods_total' => $good->price * $count, 'good_atisfied' => '##'));
         }
         // others表示其他费用
         $one['others'] = array(array('item_name' => '', 'item_value' => '', 'item_amount' => '', 'item_total' => ''));
         $one['total'] = $order->total;
         array_push($data['uncomment']['deal'], $one);
     }
     return View::make("template.personal.personal_uncomment")->with($data);
 }
开发者ID:andycall,项目名称:haochigou,代码行数:56,代码来源:UserCenterController.php

示例7: getTopbar

 /**
  * 功能:商家菜单页top_bar
  * 模块:前台
  *
  * 测试完成
  * 对应API:API/shop/商家菜单页
  */
 public function getTopbar($shop_id)
 {
     $shop = Shop::find($shop_id);
     $top_bar = array('url' => array(), 'data' => array());
     $top_bar['url']['return_back'] = '';
     // 返回主页的地址
     $top_bar['url']['shop_url'] = (string) $shop_id;
     // 当前商家的地址
     $top_bar['url']['comment_url'] = $shop_id . '/comments';
     // 商家评论页的地址
     $top_bar['url']['menu_url'] = (string) $shop_id;
     // 商家菜单的地址
     $top_bar['url']['photo_url'] = $shop_id . '/photo';
     // 美食墙的地址
     $top_bar['url']['message_url'] = $shop_id . '/message';
     // 商家留言的地址
     #TODO:在routes前端自己写的数据里有map_url选项,API里有两个不同的top_bar->url
     $top_bar['url']['map_url'] = '地图地址';
     $top_bar['data'] = $this->getShopInfo($shop_id);
     return $top_bar;
 }
开发者ID:uwitec,项目名称:haochigo,代码行数:28,代码来源:ShopController.php

示例8: getUserBarCart

 public function getUserBarCart()
 {
     if (Auth::check()) {
         $cartkey = Auth::user()->front_uid;
     } else {
         $cartkey = $this->getIP();
     }
     $key = 'laravel:user:' . $cartkey . ':cart';
     if ($shop_id = Redis::lindex($key, 0)) {
         $data['successs'] = 'true';
         $data['state'] = 200;
         $data['errMsg'] = '';
         $data['no'] = 0;
         $shop = Shop::find($shop_id);
         $data['data']['url'] = 'shop/' . $shop_id;
         $data['data']['shop_name'] = $shop->name;
         $data['data']['all_value'] = 0;
         $data['data']['state'] = $shop->state == 0 ? 0 : 1;
         if ($shop->state == 1) {
             $data['data']['state_msg'] = '店铺打烊了';
         } elseif ($shop->state == 2) {
             $data['data']['state_msg'] = '店铺太忙了';
         } else {
             $data['data']['state_msg'] = '';
         }
         $ids = array_count_values(Redis::lrange($key, 1, -1));
         $data['data']['goods'] = array();
         foreach ($ids as $id => $count) {
             $menu = Menu::find($id);
             $value = $menu->price * $count;
             $data['data']['all_value'] += $value;
             array_push($data['data']['goods'], array('good_name' => $menu->title, 'good_value' => $value, 'good_count' => $count));
         }
         return Response::json($data);
     } else {
         return array('success' => 'false', 'state' => 200, 'errMsg' => '', 'no' => 0, 'data' => array());
     }
 }
开发者ID:andycall,项目名称:haochigou,代码行数:38,代码来源:ShopController.php

示例9: modifyInfo

 /**
  * 修改店铺基本信息
  */
 public function modifyInfo()
 {
     $record = array('name' => Input::get('shop_name'), 'type' => Input::get('shop_type'), 'address' => Input::get('shop_address'), 'begin_time' => Input::get('deliver_begin'), 'operation_time' => Input::get('shop_time'), 'intro' => Input::get('shop_statement'));
     $rules = array('name' => 'required | max:50', 'type' => 'required | max:45', 'address' => 'required | max:255', 'begin_time' => 'required | max:10', 'operation_time' => 'required | max:100', 'intro' => 'required | max:255');
     $v = Validator::make($record, $rules);
     if ($v->fails()) {
         $message = $v->messages();
         $error['msg'] = $message->toArray();
         $error['status'] = '400';
         return $error;
     }
     if (Shop::find(Auth::user()->shop_id)->update($record)) {
         return Redirect::to('/shop_info')->with('infoMsg', '修改基本信息!');
     } else {
         return json_encode(array('status' => '400', 'msg' => 'modify failed'));
     }
 }
开发者ID:andycall,项目名称:map_admin_RD,代码行数:20,代码来源:ShopAdminController.php

示例10: getMyStore

 /**
  * 获取我收藏的店铺,最多5个
  */
 public function getMyStore()
 {
     if (!Auth::check()) {
         return array('url' => url('personal/collection/shop'), 'data' => array());
     }
     $user = Auth::user();
     $stores = CollectShop::where('uid', $user->front_uid)->orderBy('uptime', 'desc')->take(5)->lists('shop_id');
     $my_store = array();
     $my_store['url'] = url('personal/collection/shop');
     $my_store['data'] = array();
     foreach ($stores as $store) {
         $onestore = array();
         $shop = Shop::find($store);
         $onestore['shop_id'] = $shop->id;
         $onestore['place_id'] = 'null';
         // 地址ID,暂时不用
         $onestore['shop_url'] = url('shop/' . $shop->id);
         // 点击跳转到相应商家
         $onestore['shop_logo'] = $shop->pic;
         // 商家的logo图片地址
         $onestore['deliver_time'] = (double) $shop->interval;
         // 送货时间间隔
         $onestore['deliver_start'] = $shop->operation_time;
         // ----------------------------没有开始时间,只有一个时间字符串
         $onestore['shop_name'] = mb_strlen($shop->name, 'utf8') > 5 ? mb_substr($shop->name, 0, 8, 'utf8') : $shop->name;
         // 商家名称
         $onestore['shop_type'] = $shop->type;
         // 商家类型,以逗号分隔的字符串---------------------------这个还是问一下
         $Level = $this->getLevel($shop);
         $onestore['shop_level'] = $Level['thing_total'];
         // 商家评级
         $onestore['order_count'] = (double) $shop->sold_num;
         // 订单总量
         $onestore['is_opening'] = $this->isOnline($shop->operation_time, date('H:i')) ? 0 : 1;
         // 营业状态
         $onestore['is_ready_for_order'] = $shop->reserve;
         // 是否接受预定
         array_push($my_store['data'], $onestore);
     }
     return $my_store;
 }
开发者ID:andycall,项目名称:haochigou,代码行数:44,代码来源:MainController.php

示例11: getMyStore

 /**
  * 获取我收藏的店铺,最多5个
  * @return 
  */
 public function getMyStore()
 {
     if (!Auth::check()) {
         return array('url' => 'personal/collection/shop', 'data' => array());
     }
     $user = Auth::user();
     $stores = CollectShop::where('uid', $user->front_uid)->orderBy('uptime', 'desc')->take(5)->lists('shop_id');
     $my_store = array();
     $my_store['url'] = 'personal/collection/shop';
     $my_store['data'] = array();
     foreach ($stores as $store) {
         $onestore = array();
         $shop = Shop::find($store);
         $onestore['shop_id'] = $shop->id;
         #TODO:place_id不需要
         $onestore['place_id'] = '123';
         // ----------------------------------------后期可能是x和y
         $onestore['shop_url'] = 'shop/' . $shop->id;
         // 点击跳转到相应商家
         $onestore['shop_logo'] = $shop->pic;
         // 商家的logo图片地址
         $onestore['deliver_time'] = $shop->interval;
         // 送货时间间隔
         $onestore['deliver_start'] = $shop->operation_time;
         // ----------------------------没有开始时间,只有一个时间字符串
         $onestore['shop_name'] = $shop->name;
         // 商家名称
         $onestore['shop_type'] = $shop->type;
         // 商家类型,以逗号分隔的字符串---------------------------这个还是问一下
         $Level = $this->getLevel($shop);
         $onestore['shop_level'] = $Level['thing_total'];
         // 商家评级
         $onestore['order_count'] = $shop->sold_num;
         // 订单总量
         $onestore['is_opening'] = $shop->state;
         // 营业状态
         $onestore['is_ready_for_order'] = $shop->reserve;
         // 是否接受预定
         array_push($my_store['data'], $onestore);
     }
     return $my_store;
 }
开发者ID:uwitec,项目名称:haochigo,代码行数:46,代码来源:MainController.php

示例12: edit

 /**
  * Show the form for editing the specified shop.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     $shop = Shop::find($id);
     return View::make('shops.edit', compact('shop'));
 }
开发者ID:noikiy,项目名称:posco-laravel-server,代码行数:11,代码来源:ShopsController.php


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