Example #1
0
 /**
  * Returns array of categories based on restaurant ID
  *
  * @param $restaurant_id
  *
  * @return array
  */
 public static function getFormattedRestaurantCategories($restaurant_id)
 {
     $restaurant_categories = self::join('restaurants_category', 'categories.id', '=', 'restaurants_category.category_id')->where('restaurants_category.restaurant_id', $restaurant_id)->select('categories.id as id', 'categories.type as type', 'categories.name')->get();
     $category_data = array();
     foreach ($restaurant_categories as $category) {
         $category_data[] = ModelFormatter::categoryFormat($category);
     }
     return $category_data;
 }