Force https for pagination

92 0 0 0

Last Updated : 2021-12-03 01:29:20

sometimes the https works normally, but the pagination links fire http instead https, so the solution is to use setPath('') on the collection as follows :

$items = CalendarCommitteeEventModel::orderBy("date","DESC")->paginate(50) ;
$items->setPath(''); //This will allow the pagination links to use the same https protocol

Mohammed Anwar

Mohammed Anwar

Experienced technical lead PHP, MySQL and Laravel Developer for 15+ years, with proven ability to develop and create high-quality and optimized web applications. Great ability to build and optimize database design, schema and queries. Versed programing trainer and instructor delivering web courses and helping others to get into the field in a timely manner. Fast and eager learner for new technologies .