Generation

generate functionSat, 12 Nov 2022

select 10 records from model and return it paginated

public function getRecordsByPage($page, $perPage) { $from = ($page - 1) * $perPage; $to = $from + $perPage; return Model::limit($from, $to)->get(); } $records = getRecordsByPage(1, 10);

Want to kickstart your project?Use the new AI Studio to create your code