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


PHP City::with方法代码示例

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


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

示例1: show

 /**
  * Display the specified resource.
  *
  * @param  int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $city = City::with('country')->findOrFail($id);
     $statusCode = 200;
     $response = ["city" => ['id' => $city->id, 'city' => $city->city, 'country_id' => $city->country_id, 'country' => $city->country->country]];
     return response($response, $statusCode);
 }
开发者ID:mudragel,项目名称:matematika-test.loc,代码行数:14,代码来源:CityController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //$countries = \App\Country::all()->lists('name','id');
     //$states = \App\State::all()->lists('name','id');
     $cities = \App\City::with('state')->get();
     return response()->json($cities);
     return view('states.index', ['cities' => $cities]);
 }
开发者ID:atindermann08,项目名称:readr,代码行数:13,代码来源:CityController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($country_id)
 {
     $statusCode = 200;
     $response = ['cities' => []];
     Country::findOrFail($country_id);
     $cities = City::with('country')->where('country_id', '=', $country_id)->get();
     foreach ($cities as $city) {
         $response['cities'][] = ['id' => $city->id, 'city' => $city->city, 'country_id' => $country_id, 'country' => $city->country->country];
     }
     return response($response, $statusCode);
 }
开发者ID:mudragel,项目名称:matematika-test.loc,代码行数:16,代码来源:CityController.php

示例4: showCustomerAccount

 public function showCustomerAccount($id, $type)
 {
     //if($type=="Info"||$type=="Favorites"||$type=="Wishlist"){
     $market_data = Market::with('category')->get();
     $city = City::with('area')->get();
     if (Auth::check()) {
         $id = Auth::user()->login_id;
         $user = User::where('id', $id)->with('member')->get();
         return view('client.pages.account-page')->with('user', $user)->with('market_data', $market_data)->with('city', $city)->with('type', $type);
     } else {
         return redirect('/Market');
     }
 }
开发者ID:arielespiritu,项目名称:homemalldev,代码行数:13,代码来源:CustomerAccountController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($country_id, $city_id)
 {
     $statusCode = 200;
     $city = City::with(['country'])->findOrFail($city_id);
     if ($city->country->id != $country_id) {
         throw new ModelNotFoundException();
     }
     $languages = City::findOrFail($city_id)->language()->get();
     foreach ($languages as $language) {
         $response['languages'][] = ['id' => $language->id, 'language' => $language->language];
     }
     return response($response, $statusCode);
 }
开发者ID:mudragel,项目名称:matematika-test.loc,代码行数:18,代码来源:LanguageController.php

示例6: city

 public function city($country, $city)
 {
     $this_city = City::with('country')->where('city_slug', $city)->first();
     $airlines = Flight::where('city_slug', $city)->where('scheduled_time', '>', Carbon::now()->subMonths(1))->where('codeshare', 0)->orderBy('airline', 'asc')->groupBy('airline')->get();
     /*
     $arrivalflights = Arrival::where('scheduled_time','>',Carbon::now()->subMonths(1))
     	->where('origin_city', $city)
     	->where('codeshare',0)
     	->groupBy('flight_number')
     	->get();
     */
     $arrivalflights = Flight::select(DB::raw('*, strftime("%H:%M %w",scheduled_time) as timeDay, strftime("%H:%M",scheduled_time) as time, strftime("%w",scheduled_time) as dayofweek'))->where('scheduled_time', '>', Carbon::now()->subWeeks(1))->where('city_slug', $city)->where('codeshare', 0)->where('arrival', 1)->orderBy('dayofweek', 'asc')->orderBy('time', 'asc')->groupBy('timeDay')->get();
     $departureflights = Flight::select(DB::raw('*, strftime("%H:%M %w",scheduled_time) as timeDay, strftime("%H:%M",scheduled_time) as time, strftime("%w",scheduled_time) as dayofweek'))->where('scheduled_time', '>', Carbon::now()->subWeeks(1))->where('city_slug', $city)->where('codeshare', 0)->where('departure', 1)->orderBy('dayofweek', 'asc')->orderBy('time', 'asc')->groupBy('timeDay')->get();
     $arrivals = Flight::with('country')->where('city_slug', $city)->where('codeshare', 0)->where('arrival', 1)->orderBy('scheduled_time', 'desc')->take(5)->get();
     $departures = Flight::with('country')->where('city_slug', $city)->where('codeshare', 0)->where('departure', 1)->orderBy('scheduled_time', 'desc')->take(5)->get();
     return view('pages.city')->with(['this_city' => $this_city, 'airlines' => $airlines, 'arrivalflights' => $arrivalflights, 'departureflights' => $departureflights, 'arrivals' => $arrivals, 'departures' => $departures]);
 }
开发者ID:jedlicka82,项目名称:pragueairport,代码行数:17,代码来源:PagesController.php

示例7: getCitiesWithUserPaginate

 /**
  * Get Citys with user paginate.
  *
  * @param  integer $n
  * @return collection
  */
 public function getCitiesWithUserPaginate($n)
 {
     $citys = City::with('user')->latest()->simplePaginate($n);
     return $citys;
 }
开发者ID:purgesoftwares,项目名称:bloodapp,代码行数:11,代码来源:CityRepository.php


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