當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Location::with方法代碼示例

本文整理匯總了PHP中app\Location::with方法的典型用法代碼示例。如果您正苦於以下問題:PHP Location::with方法的具體用法?PHP Location::with怎麽用?PHP Location::with使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Location的用法示例。


在下文中一共展示了Location::with方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index

 public function index()
 {
     // $locations = Location::all();
     // return view('locations',['locations'=>$locations]);
     $locations = Location::with('stories')->get();
     return view('locations', ['locations' => $locations]);
 }
開發者ID:annievuvu,項目名稱:Programming-Assignments,代碼行數:7,代碼來源:LocationController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $state = \Input::get('state');
     $county = \Input::get('county');
     $location = \App\Location::with('products')->where(['state' => $state, 'county' => $county])->firstOrFail();
     $products = $location->products;
     return view('products.index', compact('location', 'products'));
 }
開發者ID:baudday,項目名稱:sagar,代碼行數:13,代碼來源:ProductsController.php

示例3: search

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function search(Request $request)
 {
     if ($request->input('term')) {
         $locations = Location::with('latestPrice')->where('address', 'like', $request->input('term') . '%')->orderBy('address')->orderBy('number')->get();
         $search = true;
     } else {
         $locations = Location::with('latestPrice')->orderBy('address')->orderBy('number')->get();
         $search = false;
     }
     return response()->json(["status" => "OK", "search" => $search, "data" => $locations]);
 }
開發者ID:elconejito,項目名稱:RabbitHome,代碼行數:16,代碼來源:LocationController.php

示例4: dashboard

 public function dashboard()
 {
     $today = Carbon::today('Europe/Brussels');
     $now = Carbon::now('Europe/Brussels');
     $clients = Client::where('leavetime', '=', null)->get();
     $clientsWithTable = collect([]);
     foreach ($clients as $client) {
         if ($client->table != null) {
             $clientsWithTable->push($client);
         }
     }
     foreach ($clientsWithTable as $client) {
         if (count($client->orders) > 0) {
             $order = $client->orders()->where('endtime', '=', null)->first();
             if ($order) {
                 $client->wait_time = $now->diffInMinutes(Carbon::createFromFormat('Y-m-d H:i:s', $order->starttime));
             }
         }
     }
     $areas = ['' => 'Gebieden'] + Area::orderby('name', 'ASC')->lists('name', 'id')->all();
     $locations = Location::with('table')->with('decoration')->get();
     return View::make('dashboard')->with('today', $today)->with('clientsWithTable', $clientsWithTable)->with('areas', $areas)->with('locations', $locations);
 }
開發者ID:jimpeeters,項目名稱:ProjectInternetOfThings,代碼行數:23,代碼來源:MainController.php

示例5: index

 public function index()
 {
     $location = Location::with('storys')->get();
     //$location = Location::all();
     return view('locations', ['locations' => $location]);
 }
開發者ID:rhyme9316,項目名稱:Programming-Assignments,代碼行數:6,代碼來源:LocationController.php

示例6: index

 public function index()
 {
     $locations = Location::with(’stories’)->get();
     return view(‘locations’, [‘locations’ => $locations]);
 }
開發者ID:alduin1992,項目名稱:Programming-Assignments,代碼行數:5,代碼來源:LocationController.php


注:本文中的app\Location::with方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。