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


PHP City::orderBy方法代码示例

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


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

示例1: add

 public function add()
 {
     $data = [];
     $url['back_url'] = 'city';
     $data['city'] = City::orderBy('created_at', 'DESC')->paginate(10);
     return View('city/add', $data)->nest('panel', 'sections.panel', $url);
 }
开发者ID:shkatovdm,项目名称:phponline_laravel,代码行数:7,代码来源:CityController.php

示例2: getSearch

 public function getSearch()
 {
     // get all the cities from cities table in alphabetical order
     $city = City::orderBy('name')->get();
     //make the insert view with cities
     return View::make('search')->with('cities', $city);
 }
开发者ID:Hirantha1989,项目名称:Hotel-Aplication,代码行数:7,代码来源:SearchController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $cities = City::orderBy('name')->get();
     $selector = array();
     foreach ($cities as $city) {
         $selector[$city->id] = $city->name;
     }
     return view('admin.investiments', ['cities' => $selector]);
 }
开发者ID:EnriqueSampaio,项目名称:dag-parser,代码行数:14,代码来源:InvestimentController.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $cities = City::orderBy('name')->get();
     foreach ($cities as $city) {
         $day = substr($city->founded, 8);
         $month = substr($city->founded, 5, -3);
         $year = substr($city->founded, 0, -6);
         $city->founded = $day . "/" . $month . "/" . $year;
     }
     return view('admin.cities', ['cities' => $cities]);
 }
开发者ID:EnriqueSampaio,项目名称:dag-parser,代码行数:16,代码来源:CityController.php

示例5: getInsert

 public function getInsert()
 {
     //Use to insert data to the cities table for time being
     /*$city = new City;
     
     		 $city->name = 'Colombo';
     
     		 $city->save();*/
     // get all the cities from cities table in alphabetical order
     $city = City::orderBy('name')->get();
     //make the insert view with cities
     return View::make('insert')->with('cities', $city);
 }
开发者ID:Hirantha1989,项目名称:Hotel-Aplication,代码行数:13,代码来源:InsertController.php

示例6: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $toronto_districts = array("Alexandra Park", "The Annex", "Baldwin Village", "Cabbagetown", "CityPlace", "Chinatown", "Church and Wellesley", "Corktown", "Discovery District", "Distillery District");
     $paris_districts = array("Louvre", "Bourse", "Temple", "Hôtel-de-Ville", "Panthéon", "Luxembourg", "Palais-Bourbon", "Élysée", "Opéra");
     $nyc_districts = array("Downtown Manhattan", "Little Germany (historic)", "Alphabet City and Loisaida", "East Village", "Greenwich Village", "NoHo", "Bowery", "West Village", "Lower East Side");
     $cities = City::orderBy('id', 'asc')->get();
     foreach ($cities as $city) {
         if (strcmp("New York City", $city->name) == 0) {
             foreach ($nyc_districts as $district) {
                 DB::table('districts')->insert(['name' => $district, 'description' => '', 'city_id' => $city->id]);
             }
         } elseif (strcmp("Toronto", $city->name) == 0) {
             foreach ($toronto_districts as $district) {
                 DB::table('districts')->insert(['name' => $district, 'description' => '', 'city_id' => $city->id]);
             }
         } elseif (strcmp("Paris", $city->name) == 0) {
             foreach ($paris_districts as $district) {
                 DB::table('districts')->insert(['name' => $district, 'description' => '', 'city_id' => $city->id]);
             }
         }
     }
 }
开发者ID:benpbrown,项目名称:cmpe332-site,代码行数:27,代码来源:DistrictsTableSeeder.php

示例7: redirect

     $data = $request->all();
     $validator = Validator::make($request->all(), ['property_id' => 'required|numeric|integer|min:0']);
     if ($validator->fails()) {
         return redirect(url('/admin'))->withInput()->withErrors($validator);
     }
     $user = Property::find($data['property_id'])->delete();
     return redirect(url('/admin'));
 });
 Route::delete('/property/photo/{picture}', function (Picture $picture) {
     \Cloudinary\Uploader::destroy($picture->cloudinary_public_id);
     $property_id = PropertyPictureBridge::where('picture_id', $picture->id)->get()[0]->property_id;
     $picture->delete();
     return redirect(url('/property/edit/photos/' . $property_id));
 });
 Route::get('/property/edit/{property_id}', function ($property_id) {
     $cities = City::orderBy('name', 'asc')->get();
     $property = Property::find($property_id);
     $property->district_name = District::find($property->district_id)->name;
     $property->city_name = City::find($property->city_id)->name;
     $amenities = PropertyFeatures::where('property_id', $property->id)->get()[0];
     return view('edit_property', ['property' => $property, 'cities' => $cities, 'amenities' => $amenities]);
 });
 Route::get('/property/edit/photos/{property_id}', function ($property_id) {
     $property = Property::find($property_id);
     $images = get_all_images_from_property_id_without_placeholder($property_id);
     return view('edit_images', ['property' => $property, 'images' => $images]);
 });
 Route::post('/property/edit', function (Request $request) {
     $data = $request->all();
     $validator = Validator::make($request->all(), ['title' => 'required|max:255', 'city' => 'required', 'district' => 'required', 'address' => 'required|max:255', 'type' => 'required|in:private_room,shared_room,entire_place', 'max_occupancy' => 'required|numeric|min:0|integer', 'price_per_night' => 'required|numeric|min:0|max:9999.99', 'description' => 'required', 'property_id' => 'required|numeric|integer|min:0']);
     if ($validator->fails()) {
开发者ID:benpbrown,项目名称:cmpe332-site,代码行数:31,代码来源:routes.php

示例8: cities

 public function cities()
 {
     $cities = City::orderBy('city_name', 'asc')->get();
     return view('scrapers.cities')->with(['cities' => $cities]);
 }
开发者ID:jedlicka82,项目名称:pragueairport,代码行数:5,代码来源:BackdoorController.php


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