Skip to content

Commit

Permalink
🔧 paginatation tweaks, added sucecss
Browse files Browse the repository at this point in the history
  • Loading branch information
acidjazz committed Sep 18, 2018
1 parent 0c85a6d commit fd9b8f0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/MetApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ protected function addMeta($name, $value) {
$this->meta[$name] = $value;
}

protected function paginate($collection) {
protected function paginate($collection,$perpage=15) {

$collection = $collection->paginate();
$collection = $collection->paginate($perpage);

$paginator = new Paginator(
$collection->total(),
Expand Down Expand Up @@ -161,11 +161,21 @@ protected function error($key='unknown',$message='Unknown Error') {
return $this->render(['errors' => $this->errors], false, false, 500);
}

/**
* Render success
* @param string
* @return \Illuminate\Http\Response
*/
protected function success($message='Successful')
{
return $this->render(['success' => true,'type' => 'success', 'message' => __($message)]);
}

/**
* Final output
* @param mixed $data data to be sent
* @param integer $code response code, defaulting to 200
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\JsonResponse|\Symfony\Component\HttpFoundation\Response
* @return \Illuminate\Http\Response
*/
protected function render($data=false,$code=200) {

Expand Down

0 comments on commit fd9b8f0

Please sign in to comment.