/** * Display a listing of the Author. * GET|HEAD /authors * * @return Response */ public function index(Request $request) { $offset = $request->page ? $request->page : 1; $limit = $request->limit ? $request->limit : 12; $offset = ($offset - 1) * $limit; $posts = Author::orderBy('id', 'desc')->offset($offset)->limit($limit)->get(); return response()->json($posts); }
public function getIndex() { return ApiResponseFactory::MakeEnvelope(Author::orderBy('name', 'asc')->get()->toArray()); }