Пример #1
0
 public function showResults()
 {
     $data = array('title' => 'Resultados');
     $data['sports'] = Sport::all()->lists('description', 'idSport');
     $data['tests'] = Test::all()->lists('name', 'idTest');
     $data['cities'] = City::all()->lists('description', 'idCity');
     return View::make('results', $data);
 }
Пример #2
0
 public function showWelcome()
 {
     $sports = Sport::all();
     $cities = Location::all();
     /* pull list of cities for events from events table city column */
     $sportDropdown = [];
     $sportDropdown[-1] = 'Select a Sport';
     $cityDropdown = [];
     $cityDropdown[-1] = 'Select a City';
     foreach ($sports as $sport) {
         $sportDropdown[$sport->id] = $sport->sport;
     }
     foreach ($cities as $city) {
         $cityDropdown[$city->id] = $city->city;
     }
     return View::make('home')->with('sportDropdown', $sportDropdown)->with('cityDropdown', $cityDropdown);
 }
Пример #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $location = Location::firstOrFail();
     $user = User::firstOrFail();
     $sport = Sport::all();
     $event = new GameEvent();
     $event->sport_id = 2;
     $event->event_name = 'Fútbol Game';
     $event->start_time = 'Monday, Oct. 5, 2015 1:00 pm';
     $event->end_time = 'Monday, Oct. 5, 2015 4:00 pm';
     $event->location_id = $location->id;
     $event->gender = 'Co-Ed';
     $event->skill_level = 'Intermediate';
     $event->amount = 2.0;
     $event->organizer_id = 1;
     $event->event_image = 'http://lorempixel.com/200/200/sports/6/';
     $event->description = 'testing 123';
     $event->save();
 }
 /**
  * Show the form for editing the specified gameevent.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $event = GameEvent::find($id);
     $sports = Sport::all();
     $locations = Location::all();
     if (!$event) {
         App::abort(404);
     }
     if (!Auth::check()) {
         return Redirect::action('UsersController@doLogin');
     } elseif (Auth::id() == $event->organizer_id || Auth::user()->role == 'admin') {
         $dropdownL = [];
         $dropdownL[-1] = 'Add new address';
         foreach ($locations as $location) {
             $dropdownL[$location->{$id}] = $location->name_of_location;
         }
         $dropdownS = [];
         $dropdownS[-1] = 'Select Sport';
         foreach ($sports as $sport) {
             $dropdownS[$sport->{$id}] = $sport->sport;
         }
         return View::make('game_events.edit')->with('dropdown', $dropdownL)->with('dropdownS', $dropdownS)->with('event', $event);
     } else {
         Session::flash('errorMessage', 'Access not authorized');
         return Redirect::action('GameEventsController@index');
     }
 }