本文整理汇总了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]);
}
示例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'));
}
示例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]);
}
示例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);
}
示例5: index
public function index()
{
$location = Location::with('storys')->get();
//$location = Location::all();
return view('locations', ['locations' => $location]);
}
示例6: index
public function index()
{
$locations = Location::with(’stories’)->get();
return view(‘locations’, [‘locations’ => $locations]);
}