/** @test */
 public function it_gets_event_results_from_apis()
 {
     $eventQueries = [];
     $eventQueries[] = $this->createEvent('campground', 'family', EventQuery::GOOGLE_TYPE_QUERY);
     $eventQueries[] = $this->createEvent('sushi', 'family', EventQuery::GOOGLE_NAME_QUERY);
     $eventQueries[] = $this->createEvent('festival', 'family', EventQuery::EVENTFUL);
     $results = $this->logicEngine->findEventsNearby($eventQueries);
     $this->assertNotEmpty($results);
     $this->assertTrue(array_key_exists('campground', $results));
     $this->assertTrue(array_key_exists('sushi', $results));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function getEvents()
 {
     if (empty(Input::get('location'))) {
         return Redirect::back();
     }
     $coordinates = $this->google->getCoordinates(Input::get('location'));
     $categories = $this->createCategoriesArray(Input::all());
     if (empty($categories['categories']) || empty($coordinates)) {
         return Redirect::back();
     }
     $location = $coordinates['location'];
     unset($coordinates['location']);
     $array = [];
     $array['location'] = $coordinates;
     $query = (new EventQueryBuilder(array_merge($categories, $array)))->buildQuery();
     $results = $this->logicEngine->findEventsNearby($query);
     return view('results', ['events' => $results, 'location' => $location]);
 }