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


PHP City::all方法代碼示例

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


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

示例1: edit

 public function edit($id)
 {
     $cities = City::all();
     $categories = Category::all();
     $post = $this->postRepository->getById($id);
     return view('posts.edit', compact('post', 'cities', 'categories'));
 }
開發者ID:kondipakamey,項目名稱:atofa,代碼行數:7,代碼來源:PostController.php

示例2: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $communitys = Community::all();
     $cities = City::all();
     $categories = Category::all();
     return view('posts.create', ['communitys' => $communitys, 'categories' => $categories, 'cities' => $cities]);
 }
開發者ID:jakeboyles,項目名稱:GuyBuy,代碼行數:12,代碼來源:PostController.php

示例3: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     $pages = Page::all();
     $cities = City::all();
     view()->share('pages', $pages);
     view()->share('cities', $cities);
 }
開發者ID:AbuLoot,項目名稱:vi,代碼行數:12,代碼來源:AppServiceProvider.php

示例4: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $cities = City::all();
     // Grab all the cities and then do a for each.
     // run this for each of them.
     foreach ($cities as $city) {
         $events = Event::where('city_id', '=', $city->id)->where('time_end', '>=', date('Y-m-d H:i:s'))->where('time_end', '<=', date('Y-m-d H:i:s', strtotime('+2 weeks')))->orderBy('time_start', 'asc')->get();
         if (!count($events)) {
             $this->comment('No events found for ' . $city->name . '. Mailer not sent.');
             continue;
         }
         $categories = Category::orderBy('title', 'asc')->get();
         if ($this->option('email')) {
             $subscriber = new Subscriber();
             $subscriber->name = 'Test User';
             $subscriber->email = $this->option('email');
             $subscribers = [$subscriber];
             $this->comment('Sent test email to ' . $this->option('email'));
         } else {
             $subscribers = Subscriber::where('city_id', '=', $city->id)->get();
         }
         $count = 0;
         foreach ($subscribers as $subscriber) {
             Mail::send('emails.subscribers.mailer', ['subscriber' => $subscriber, 'events' => $events, 'categories' => $categories, 'city' => $city], function ($m) use($subscriber, $city) {
                 $m->from('messages@madebyfieldwork.com', 'See+Do')->to($subscriber->email, $subscriber->name)->subject('Weekly Round-Up of Things to See+Do in ' . $city->name)->getHeaders()->addTextHeader('X-MC-Subaccount', 'see-do');
             });
             $count++;
         }
         $this->comment('Sent to ' . $count . ' email addresses in ' . $city->name . '.');
         $count = 0;
     }
 }
開發者ID:EMT,項目名稱:see-do,代碼行數:37,代碼來源:SendMailer.php

示例5: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $zone = Zone::findOrFail($id);
     $page = "Editer " . $zone->name;
     $cities = City::all();
     return view('admin.zone.edit', compact('zone', 'page', 'cities'));
 }
開發者ID:francoislevesque,項目名稱:lavalpme,代碼行數:13,代碼來源:zoneController.php

示例6: index

 public function index()
 {
     $cities = City::all();
     //        $locations = Location::all();
     //        return view('worldmap.map')->with(compact('locations'));
     return view('worldmap.worldmap')->with(compact('cities'));
 }
開發者ID:Ravaelles,項目名稱:Elder,代碼行數:7,代碼來源:WorldmapController.php

示例7: index

 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $posts = Post::with('author', 'comments.author', 'community')->where('sold', NULL)->orderBy('created_at', 'desc')->take(4)->get();
     $mostPopular = Post::with('author', 'comments.author', 'community')->where('sold', NULL)->take(4)->get();
     $communities = Community::all();
     $cities = City::all();
     return view('pages.home', ['posts' => $posts, 'mostPopular' => $mostPopular, 'communities' => $communities, 'cities' => $cities]);
 }
開發者ID:jakeboyles,項目名稱:GuyBuy,代碼行數:13,代碼來源:HomeController.php

示例8: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $allusers = User::all();
     $url = "https://randomapi.com/api/?key=" . env('RANDOMAPI_API_KEY') . "&id=6tnf0qn&results=50";
     $json = file_get_contents($url);
     $json_data = json_decode($json, true);
     $types = ['private_room', 'shared_room', 'entire_place'];
     foreach ($json_data['results'] as $result) {
         $result = $result['object'];
         $property = new Property();
         $property->title = $result['title'];
         $oneuser = $allusers[rand(0, count($allusers) - 1)];
         $property->owner_id = $oneuser->id;
         $property->address = explode(" | ", $result['address'])[2];
         $all_cities = City::all();
         $property->city_id = $all_cities[rand(0, count($all_cities) - 1)]->id;
         $valid_districts = District::where('city_id', $property->city_id)->get();
         $property->district_id = $valid_districts[rand(0, count($valid_districts) - 1)]->id;
         $property->type = $types[array_rand($types)];
         $property->price_per_night = rand(20, 1333);
         $property->max_occupancy = rand(1, 6);
         $property->description = 'A charming ' . $result['title'];
         $property->save();
         $features = new PropertyFeatures();
         $features->property_id = $property->id;
         $features->kitchen = rand(0, 1) == 1;
         $features->internet = rand(0, 1) == 1;
         $features->tv = rand(0, 1) == 1;
         $features->essentials = rand(0, 1) == 1;
         $features->shampoo = rand(0, 1) == 1;
         $features->heating = rand(0, 1) == 1;
         $features->air_conditioning = rand(0, 1) == 1;
         $features->washer = rand(0, 1) == 1;
         $features->dryer = rand(0, 1) == 1;
         $features->free_parking_on_premises = rand(0, 1) == 1;
         $features->wireless_internet = rand(0, 1) == 1;
         $features->cable_tv = rand(0, 1) == 1;
         $features->breakfast = rand(0, 1) == 1;
         $features->pets_allowed = rand(0, 1) == 1;
         $features->family_kid_friendly = rand(0, 1) == 1;
         $features->suitable_for_events = rand(0, 1) == 1;
         $features->smoking_allowed = rand(0, 1) == 1;
         $features->wheelchair_accessible = rand(0, 1) == 1;
         $features->elevator_in_building = rand(0, 1) == 1;
         $features->indoor_fireplace = rand(0, 1) == 1;
         $features->buzzer_wireless_intercom = rand(0, 1) == 1;
         $features->doorman = rand(0, 1) == 1;
         $features->pool = rand(0, 1) == 1;
         $features->hot_tub = rand(0, 1) == 1;
         $features->gym = rand(0, 1) == 1;
         $features->feature_24_hour_check_in = rand(0, 1) == 1;
         $features->hangers = rand(0, 1) == 1;
         $features->iron = rand(0, 1) == 1;
         $features->hair_dryer = rand(0, 1) == 1;
         $features->laptop_friendly_workspace = rand(0, 1) == 1;
         $features->save();
     }
 }
開發者ID:benpbrown,項目名稱:cmpe332-site,代碼行數:63,代碼來源:PropertiesTableSeeder.php

示例9: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     if ($this->user) {
         $cities = City::all();
     } else {
         $cities = City::where('hidden', '!=', 1)->get();
     }
     return view('home.index', compact('cities'));
 }
開發者ID:EMT,項目名稱:see-do,代碼行數:14,代碼來源:CitiesController.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $title = 'CONFIG';
     $country = Country::all()->sortBy('country');
     $designation = Designation::all()->sortBy('designation');
     $city = City::all()->sortBy('city');
     $state = State::all()->sortBy('state');
     $brands = Brands::all()->sortBy('brand');
     $models = Models::all()->sortBy('model');
     $businessType = BusinessType::all()->sortBy('name');
     return view('myConfig.index', compact('title', 'country', 'designation', 'city', 'state', 'brands', 'models', 'businessType'));
 }
開發者ID:smartrahat,項目名稱:zamzam,代碼行數:17,代碼來源:MyConfigController.php

示例11: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $route = $request->path();
     if (Auth::user()) {
         $cities = City::all();
     } else {
         $cities = City::where('hidden', '!=', 1)->get();
     }
     if (count($cities) < 2 && $route == '/') {
         return redirect('/mcr');
     } else {
         return $next($request);
     }
 }
開發者ID:EMT,項目名稱:see-do,代碼行數:21,代碼來源:RedirectIfOnlyCity.php

示例12: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if ($this->option('all')) {
         foreach (City::all() as $city) {
             $city->import();
             sleep(5);
         }
     } elseif ($this->argument('city')) {
         $city = City::find($this->argument('city'));
         if (count($city)) {
             $city->import();
         }
     }
 }
開發者ID:santakani,項目名稱:santakani.com,代碼行數:19,代碼來源:CityImport.php

示例13: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     Departure::truncate();
     Line::truncate();
     Stop::truncate();
     $cities = City::all();
     foreach ($cities as $city) {
         $this->info('importing city: ' . $city->name);
         $lines = Line::import($city);
         foreach ($lines as $line) {
             $this->info('importing line: ' . $line->name);
             $stops = Stop::fullImport($line);
         }
     }
 }
開發者ID:jbiesiada,項目名稱:stopboard,代碼行數:20,代碼來源:ImportLines.php

示例14: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create($company_id)
 {
     $company = Company::find($company_id);
     $countries = Country::all();
     foreach ($countries as $ctr) {
         $country_names[$ctr->id] = $ctr->name;
     }
     $cities = City::all();
     foreach ($cities as $ct) {
         $city_names[$ct->id] = $ct->name;
     }
     foreach (Language::all() as $lang) {
         $langs[$lang->id] = $lang->name;
     }
     return view('jobs.create', compact('country_names', 'city_names', 'langs', 'company'));
 }
開發者ID:AlSt2015,項目名稱:jobs4creative,代碼行數:21,代碼來源:JobController.php

示例15: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     echo 'Warning: Running this migration is not completely backwards compatible and will make changes to event \'category_id\' references and category \'id\' references. Cancel out of this migration within the next 10 seconds if you dont have a backup...';
     echo "\n";
     sleep(15);
     echo 'Continuing with migration...';
     echo "\n";
     Schema::table('categories', function (Blueprint $table) {
         $table->integer('city_id');
     });
     $cities = City::all();
     $categories = Category::all();
     foreach ($cities as $city) {
         Category::create(['title' => 'Talks', 'city_id' => $city->id]);
         Category::create(['title' => 'Gigs', 'city_id' => $city->id]);
         Category::create(['title' => 'Exhibitions', 'city_id' => $city->id]);
         Category::create(['title' => 'Hackdays & Workshops', 'city_id' => $city->id]);
         Category::create(['title' => 'Films', 'city_id' => $city->id]);
         Category::create(['title' => 'Food & Drink', 'city_id' => $city->id]);
         $city_events = Event::all();
         foreach ($city_events as $event) {
             if ($event->city_id == $city->id) {
                 // get the current category_id.
                 // get the category by that id.
                 $old_category = Category::where('id', $event->category_id)->first();
                 // get the name of the category.
                 // find the new category for this city with that name.
                 $new_category = Category::where('slug', $old_category->slug)->where('city_id', $city->id)->first();
                 // set the event to new category.
                 $event->category_id = $new_category->id;
                 $event->save();
             }
         }
     }
     $categories = Category::all();
     foreach ($categories as $category) {
         if ($category->city_id == 0) {
             $category->delete();
         }
     }
 }
開發者ID:EMT,項目名稱:see-do,代碼行數:46,代碼來源:2016_09_23_103138_add_city_id_to_categories.php


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