/** * Display a listing of the resource. * * @return Response */ public function index() { $limit = Input::get('limit') ?: 10; $restaurants = Restaurant::paginate($limit); return $this->respond(['data' => $this->fractal->paginatedCollection($restaurants, new RestaurantTransformer())]); // $restaurants = Restaurant::all(); // return Response::json([ // 'data' => $this->fractal->collection($restaurants, new RestaurantTransformer()) // ], 200); /*return Response::json([ 'data' => $this->restaurantTransformer->transformCollection($restaurants->all()) ], 200);*/ }
/** * Get restaurants group by 10 * * @return Response */ public function paginated() { $restaurants = Restaurant::paginate(10); return response()->json(["msg" => "Success", "restaurants" => $restaurants->toArray()], 200); }