Get Pagination Data By A Specific Page Number
I want to get Data by page number, in normal when we use this code
$jobs = Jobs::paginate(10);
laravel get data by GET "page" parameter that defined in URL,
if our URL be http://www.example.com/job?page=2
laravel return data of page 2
I want to do this without using the page parameter in URL
I want you to introduce me something like this
$jobs = Jobs::paginate(10,[ 'page'=>2 ]);
Laravel paginator automatically checks for the the value of page in query string and uses it to paginate the results. The result also automatically generates the next and previous links to help you add them directly
The default paginate method takes the following parameters.
public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null);
so you use like this
$jobs = Jobs::paginate(5, ['*'], 'page', $pageNumber);
The default convention is
Also if you use
$jobs->links() to generate the navigation button
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms