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);

Questions about programming?Chat with your personal AI assistant