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


PHP Session::all方法代码示例

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


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

示例1: checkout

 public function checkout()
 {
     //Check if user is logged in
     if (!Backend::validateUser()) {
         return redirect('/');
     }
     $aRequest = \Request::all();
     //This is a temprory array that will be used to create a temp item to be used in saved and any processing on item before saving it.
     $tempItem = array();
     if (!isset($aRequest['items'])) {
         return;
     }
     /*
      * Total price will be saved here,
      * this also will be used to indicate the last price that will be required on each restaurant
      */
     foreach ($aRequest['items'] as $item) {
         $dTotalPrice = 0;
         $oItem = DB::table('food')->where(array('id_item' => $item['id_item']))->get(array("id_restaurant", "price"))[0];
         $tempItem['id_item'] = $item['id_item'];
         $tempItem['qty'] = $item['qty'];
         $tempItem['spicy'] = $item['spicy'];
         //$tempItem['note']=$item['note'];
         $tempItem['total_price'] = $oItem->price * $item['qty'];
         $dTotalPrice += $tempItem['total_price'];
         $aRestaurants[$oItem->id_restaurant]['total_price'] = $dTotalPrice;
         $aRestaurants[$oItem->id_restaurant]['items'][] = $tempItem;
         $tempItem = array();
     }
     $sNote = $aRequest['note'];
     $sLocation = json_encode($aRequest['location']);
     foreach ($aRestaurants as $id_restaurant => $aRestaurant) {
         $id_user = \Session::all()['id_user'];
         $sOrderDetails = json_encode($aRestaurant);
         $aOrder = array('id_user' => $id_user, 'id_restaurant' => $id_restaurant, 'order_details' => $sOrderDetails, 'note' => $sNote, 'location' => $sLocation, 'date_inserted' => Date('Y-m-d h:i:s'), 'status' => 'not_approved_yet');
         DB::table('orders')->insert($aOrder);
     }
     \Session::forget('cart');
     return redirect('/');
 }
开发者ID:4Bara,项目名称:Fooder-Food-ordering-website-,代码行数:40,代码来源:cartController.php

示例2: LoginData

 public static function LoginData()
 {
     $aSession = \Session::all();
     $aData = array();
     $aData['items_count'] = isset($aSession['cart']['items']) ? count($aSession['cart']['items']) : 0;
     if (isset($aSession['loggedin']) && $aSession['loggedin'] == true) {
         $aData['username'] = $aSession['username'];
         $aData['id_user'] = $aSession['id_user'];
         $aData['logged'] = 'yes';
         $aData['user_type'] = $aSession['user_type'];
     } else {
         //Not logged in logic
         $aData['logged'] = 'no';
     }
     return $aData;
 }
开发者ID:4Bara,项目名称:Fooder-Food-ordering-website-,代码行数:16,代码来源:Backend.php

示例3: showRestaurantsOrders

 public function showRestaurantsOrders()
 {
     if (!Backend::validateUser()) {
         return redirect('/');
     }
     $aSession = \Session::all();
     $aOrdersList = DB::table('orders')->where(array('id_restaurant' => $aSession['id_user']))->WhereNotIn('status', array('DONE'))->orderBy('date_inserted', 'desc')->get(array('*'));
     $aTmpOrder = array();
     $dTotalPrice = 0;
     $aOrders = array();
     foreach ($aOrdersList as $oOrder) {
         $aTmpOrder['customer'] = DB::table('users')->where(array('id_user' => $oOrder->id_user))->get(array('first_name', 'last_name', 'user_mobile', 'username', 'email'))[0];
         $oOrderDetails = json_decode($oOrder->order_details);
         $oOrder->order_details = $this->parseOrderDetails($oOrderDetails);
         $oOrder->status = str_replace('_', ' ', $oOrder->status);
         $oLocation = json_decode($oOrder->location);
         if (!empty($oLocation->lat)) {
             $aTmpOrder['location'] = "http://maps.google.com/maps?q={$oLocation->lat},{$oLocation->long}";
         }
         $aTmpOrder['info'] = $oOrder;
         $dTotalPrice += $oOrderDetails->total_price;
         $oOrder->date_inserted = Backend::ago(new \DateTime($oOrder->date_inserted));
         $aOrders[] = $aTmpOrder;
         $aTmpOrder = [];
     }
     $data = Backend::LoginData();
     $data['isRestaurant'] = true;
     $data['status'] = array('preparing', 'canceled', 'not approved yet', 'on the way');
     return view('pages.orders')->with(array('orders' => $aOrders, 'data' => $data));
 }
开发者ID:4Bara,项目名称:Fooder-Food-ordering-website-,代码行数:30,代码来源:userActions.php

示例4: addNewOffer

 public function addNewOffer()
 {
     $aSession = \Session::all();
     $this->validateUser($aSession);
     $aItemsList = DB::table('food')->where(array('id_restaurant' => $aSession['id_user']))->get(array("*"));
     $aData = array('user_type' => $aSession['user_type'], 'id_user' => $aSession['id_user'], 'page_type' => 'offer');
     return view('/pages.addNewMenu')->with(array('data' => $aData, 'items' => $aItemsList));
 }
开发者ID:4Bara,项目名称:Fooder-Food-ordering-website-,代码行数:8,代码来源:restaurantController.php

示例5:

 function back_button()
 {
     if (\Session::has('entry_date')) {
         \Session::forget('entry_date');
     }
     $active = $this->check();
     if ($active) {
         $Session = \Session::all();
         //return view('Dashboard', compact('Session'));
         return \Redirect::to('dashboard');
     } else {
         return \Redirect::to('login');
     }
 }
开发者ID:blogakgec,项目名称:dc-project2015,代码行数:14,代码来源:DashboardController.php

示例6: submitReview

 public function submitReview()
 {
     //Get the request from the submitted page
     $aRequest = \Request::all();
     //Get the Session
     $aSession = \Session::all();
     //GET RESTAURANT ID
     $aRestaurant = DB::table('restaurants')->where(array('username' => $aRequest['username']))->get(array("id_restaurant"));
     $oRestaurant = $aRestaurant[0];
     $aReview['id_restaurant'] = $oRestaurant->id_restaurant;
     $aReview['id_user'] = $aSession['id_user'];
     $aReview['body'] = $aRequest['review'];
     $aReview['rating'] = $aRequest['rating'];
     $oImage = $aRequest['review-picture'];
     //Uplaod the pociture of the review
     $FullImagePath = Backend::uploadPhotos($oImage, 'review-picture');
     $aReview['review_image'] = $FullImagePath;
     $aReview['date_created'] = Date('Y-m-d h:i:s');
     //Insert the data into Reviews Table and get it's id
     $dReviewId = DB::table('reviews')->insertGetId($aReview);
     //Add Activity to it's table
     //save activity into the DB:
     Backend::addActivity($aSession['id_user'], 'review', $dReviewId);
     //Redirect the user to the restaurant's page.
     return redirect('/p/' . $aRequest['username']);
 }
开发者ID:4Bara,项目名称:Fooder-Food-ordering-website-,代码行数:26,代码来源:restaurantController.php


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