diff --git a/src/Eloquent/BaseRepository.php b/src/Eloquent/BaseRepository.php index 1ce2d61..61ac3ee 100644 --- a/src/Eloquent/BaseRepository.php +++ b/src/Eloquent/BaseRepository.php @@ -234,14 +234,14 @@ public function firstOrFail($columns = ['*']) * Paginate the given query by 'limit' request parameter * @return mixed */ - public function smartPaginate() + public function smartPaginate($perPage = null) { $limit = (int) request()->input( config('awesio-repository.smart_paginate.request_parameter'), config('awesio-repository.smart_paginate.default_limit') ); - if ($limit === 0) $limit = config('awesio-repository.smart_paginate.default_limit'); + if ($limit === 0) $limit = ($perPage) ?: config('awesio-repository.smart_paginate.default_limit'); $maxLimit = config('awesio-repository.smart_paginate.max_limit'); @@ -263,4 +263,4 @@ public function orderBy($column, $direction = 'asc') return $this; } -} \ No newline at end of file +}