示例#1
0
 public function edit($id)
 {
     $cities = City::all();
     $categories = Category::all();
     $post = $this->postRepository->getById($id);
     return view('posts.edit', compact('post', 'cities', 'categories'));
 }
示例#2
0
 /**
  * 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]);
 }
示例#3
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     $pages = Page::all();
     $cities = City::all();
     view()->share('pages', $pages);
     view()->share('cities', $cities);
 }
示例#4
0
文件: SendMailer.php 项目: EMT/see-do
 /**
  * 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('*****@*****.**', '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;
     }
 }
 /**
  * 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'));
 }
示例#6
0
 public function index()
 {
     $cities = City::all();
     //        $locations = Location::all();
     //        return view('worldmap.map')->with(compact('locations'));
     return view('worldmap.worldmap')->with(compact('cities'));
 }
示例#7
0
 /**
  * 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]);
 }
 /**
  * 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();
     }
 }
示例#9
0
 /**
  * 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'));
 }
示例#10
0
 /**
  * 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'));
 }
示例#11
0
 /**
  * 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);
     }
 }
示例#12
0
 /**
  * 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();
         }
     }
 }
示例#13
0
 /**
  * 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);
         }
     }
 }
示例#14
0
 /**
  * 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'));
 }
 /**
  * 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();
         }
     }
 }
示例#16
0
 public function search(Request $request)
 {
     $data = array();
     $data['days'] = \App\Day::lists('name', 'id');
     $data['article'] = ArticleCategory::with('articles')->get();
     $data['city'] = \App\City::all();
     $data['specialization'] = \App\Specialization::all();
     $data['city_k'] = urldecode($request->input('city'));
     $data['specialization_k'] = urldecode($request->input('specialization'));
     $data['keyword'] = urldecode($request->input('keyword'));
     $data['gender_k'] = $request->input('gender');
     $data['practice_day_k'] = $request->input('practice_day');
     $data['city_obj'] = \App\City::where('name', 'like', '%' . $data['city_k'] . '%')->lists('id');
     $arr_specialization = \App\Specialization::where('name', 'like', '%' . $data['specialization_k'] . '%')->lists('id');
     /*$result = \App\Specialization::where('name','like','%'.$data['specialization_k'].'%')
       ->whereHas('doctors', function($query) use($data){
           $query->whereIn('city_id', $data['city_obj'])
               ->where('name','like', '%'.$data['keyword'].'%')
               ->whereHas('day', function($query) use($data){
                 if(!empty($data['practice_day_k']) > 0)
                   $query->whereIn('days.id', $data['practice_day_k']);
               })
           ;
           if(!empty($data['gender_k'])){
             $query->where('gender',$data['gender_k']);
           }
       })->
       with('doctors')->get();*/
     $result = \App\Doctor::whereIn('city_id', $data['city_obj'])->where('name', 'like', '%' . $data['keyword'] . '%')->whereHas('day', function ($query) use($data) {
         if (!empty($data['practice_day_k']) > 0) {
             $query->whereIn('days.id', $data['practice_day_k']);
         }
     });
     if (!empty($data['gender_k'])) {
         $result->where('gender', $data['gender_k']);
     }
     $result = $result->paginate(10);
     $data['article'] = ArticleCategory::with('articles')->get();
     $data['content'] = $result;
     return view('frontend.pages.home.search-result', compact('data'));
 }
示例#17
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $categoriesData = json_decode(file_get_contents("app/Jobs/categories.json"));
     DB::table('categories')->truncate();
     DB::table('ranks')->truncate();
     DB::table('places')->truncate();
     foreach ($categoriesData as $categoryData) {
         if (!isset($categoryData->parents) || !$categoryData->parents) {
             continue;
         }
         if (!in_array("restaurants", $categoryData->parents)) {
             continue;
         }
         Category::create(['name' => $categoryData->title, 'code' => $categoryData->alias]);
     }
     $allCities = City::all();
     foreach ($allCities as $city) {
         Log::info('City: ' . $city->name);
         $allCategories = Category::all();
         foreach ($allCategories as $category) {
             $yelp = new Yelp();
             Log::info('Category: ' . $category->code);
             $businesses = $yelp->best($category->code, $city->name . ', ' . $city->country);
             for ($i = 0; $i < count($businesses); $i++) {
                 $business = $businesses[$i];
                 if (!isset($business->location->coordinate)) {
                     continue;
                 }
                 Log::info('Business: ' . $business->name);
                 $place = Place::where('name', '=', $business->name)->first();
                 if (!$place) {
                     $place = Place::create(['name' => $business->name, 'image_url' => $this->getImageUrl($business), 'external_url' => $business->mobile_url, 'description' => $this->getDescription($business), 'rating' => $business->rating, 'latitude' => $business->location->coordinate->latitude, 'longitude' => $business->location->coordinate->longitude, 'address' => join(', ', $business->location->display_address), 'city_id' => $city->id]);
                 }
                 Rank::create(['category_id' => $category->id, 'place_id' => $place->id, 'rank' => $i + 1, 'city_id' => $city->id]);
             }
             sleep(1);
         }
     }
 }
示例#18
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $cities = City::all();
     return view('admin.city.index', compact('cities'));
 }
示例#19
0
 public function register()
 {
     //
     $data = array();
     $data['content'] = null;
     $data['list_gender'][0] = 'L';
     $data['list_gender'][1] = 'P';
     $data['city'] = \App\City::all();
     $data['specialization'] = \App\Specialization::all();
     $data['article'] = \App\ArticleCategory::with('articles')->get();
     return view('frontend.pages.clinic.register')->with('data', $data);
 }
示例#20
0
 public function get_all_cities()
 {
     $cities = City::all();
     return view('cities.index', ['cities' => $cities]);
 }
示例#21
0
     return view('search_properties', ['cities' => $cities]);
 });
 Route::get('/places/searchresult', function () {
     $properties = Session::get('properties');
     $cities = Session::get('cities');
     return view('list_properties', ['properties' => $properties, 'cities' => $cities]);
 });
 Route::post('/places/search', 'SearchController@searchPlaces');
 Route::get('/places/{city_id}/', array('as' => 'places', function ($city_id) {
     $properties = array();
     if ($city_id == 0) {
         $properties = Property::where('owner_id', '<>', Auth::id())->get();
     } else {
         $properties = Property::where('city_id', $city_id)->where('owner_id', '<>', Auth::id())->get();
     }
     $cities = City::all();
     foreach ($cities as $city) {
         $city->districts = District::where('city_id', $city->id);
     }
     foreach ($properties as $property) {
         $property->city_name = City::find($property->city_id)->name;
         $photo_ids = PropertyPictureBridge::where('property_id', $property->id)->get();
         if (count($photo_ids) < 1) {
             $property->image_url = env('PLACEHOLDER_IMAGE_URL');
         } else {
             $property->image_url = Picture::find($photo_ids[0]->picture_id)->url;
         }
     }
     return view('list_properties', ['properties' => $properties, 'cities' => $cities]);
 }));
 Route::get('/places/', function () {
示例#22
0
 public function index()
 {
     $cities = City::all();
     $page_title = 'Cities';
     return view('city.index', compact('cities', 'page_title'));
 }
示例#23
0
 /**
  * Главная страница админки городов
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function main()
 {
     return view('admin.city.main', ['cities' => City::all()]);
 }
示例#24
0
 public function getCities()
 {
     return json_encode(City::all());
 }
示例#25
0
 public function getEditar($id)
 {
     $almacen = Warehouse::findOrFail($id);
     $ciudades = City::all();
     return view('almacen.almacen-editar', ['almacen' => $almacen, 'ciudades' => $ciudades]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $cities = City::all();
     return $cities;
 }
 public function creerCompte()
 {
     $cities = City::all();
     return view('creer_compte', compact('cities'));
 }
示例#28
0
 /**
  * Display a list of City from Storage
  * @return static
  */
 public function city()
 {
     return City::all()->lists('city', 'city');
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $business = Business::findOrFail($id);
     $page = "Éditer " . $business->name;
     $cities = City::all();
     $categories = Category::all();
     return view('admin.business.edit', compact('page', 'cities', 'categories', 'business'));
 }
示例#30
0
 public static function getCities()
 {
     $cities = City::all();
     return \Response::json($cities);
 }