当前位置: 首页>>代码示例>>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;未经允许,请勿转载。