Example #1
0
 /** Displays list of restaurants within user's recent activity list
  * route: /restaurants/recent-activity/{user_id}/{search_key?}
  *
  * @param $user_id
  * @param $search_key (optional) for restaurant name searches
  * @return Response
  */
 public function recentActivitySearchAction($user_id, $search_key = null)
 {
     $restaurants = Restaurants::getRecentActivityRestaurants($user_id, $search_key);
     $data = array();
     foreach ($restaurants as $restaurant) {
         $categories = Categories::getFormattedRestaurantCategories($restaurant->id);
         $data[] = array(KeyParser::restaurant => ModelFormatter::restaurantLongFormat($restaurant), KeyParser::categories => $categories);
     }
     $page = array(KeyParser::current => $restaurants->currentPage(), KeyParser::number => $restaurants->lastPage());
     $json_return = array(KeyParser::data => $data, KeyParser::page => $page);
     return response()->json($json_return);
 }