public function after($number) { if (Input::has('key') == false) { return $this->response->errorUnauthorized(); } $ads = Ad::whereRaw('id > ' . $number)->orderBy('message_number', 'DESC')->paginate(50); // Pass this array (collection) into a resource, which will also have a "Transformer" // This "Transformer" can be a callback or a new instance of a Transformer object // We type hint for array, because each item in the $ads var is an array return $this->response->withPaginator($ads, new AdTransformer()); }
public function keywords() { $keywords = DB::collection('map_reduce_twitter_words')->orderBy('value', 'desc')->paginate(25); return $this->response->withPaginator($keywords, new KeywordsTransformer()); }