Paginate API incidents

This commit is contained in:
Joseph Cohen
2015-02-17 16:00:38 -06:00
parent cad6496e18
commit b0457bc7b9
3 changed files with 25 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
namespace CachetHQ\Cachet\Http\Controllers\Api;
use CachetHQ\Cachet\Repositories\Incident\IncidentRepository;
use CachetHQ\Cachet\Transformers\IncidentTransformer;
use Dingo\Api\Routing\ControllerTrait;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Routing\Controller;
@@ -37,7 +38,9 @@ class IncidentController extends Controller
*/
public function getIncidents()
{
return $this->incident->all();
$incidents = $this->incident->paginate(Binput::get('per_page', 20));
return $this->response->paginator($incidents, new IncidentTransformer());
}
/**