Created
July 13, 2024 19:24
-
-
Save laymont/39083fa3150ab615df8706bef9ee27c8 to your computer and use it in GitHub Desktop.
Set default pagination laravel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Traits; | |
use Illuminate\Http\Request; | |
trait HandlesPerPageTrait | |
{ | |
/** | |
* Get the per page value from the request. | |
* | |
* @param Request $request | |
* @return int | |
*/ | |
protected function getPerPage(Request $request): int | |
{ | |
return $request->has('per_page') ? $request->get('per_page') : 10; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment