/** * Display a listing of the resource. * * @param null $id * @return \Illuminate\Contracts\Http\Response */ public function index($id = null) { // process v1.authors.things route if ('v1.authors.things' === \Route::currentRouteName()) { return $this->respond->setMeta($this->meta)->withPagination(Author::find($id)->things()->latest()->paginate(25), new ThingTransformer()); } // Respond with pagination return $this->respond->setMeta($this->meta)->withPagination($this->model->latest()->paginate(25), new ThingTransformer()); // Respond as a collection //return $this->respond->setMeta($this->meta)->withCollection( // $this->model->latest()->get(), // new ThingTransformer //); }