Level 75
@sema314 Like
DB::table('employees')->update([
'updated_at' => date('Y-m-d H:i:s')
]);
Hi all,
So I'm pulling in all 3000+ records from a DB table that I have called 'Employees', here is the method that I am using:
Hi all,
Is it possible to use native pagination on the DB::table()->get() method? Now, I have 3000+ records in a specific table, and I'd like to trigger pagination of 1000 records at a time.
Here is the method that I have:
public function refresh()
{
$records = DB::table('employees')->get();
foreach ($records as $record)
{
$record = $this->getRecord($record);
$record->updated_at = date('Y-m-d H:i:s');
$record->save();
}
return $record;
}
Is it possible to use pagination on the get() method? Or is there a more efficient way that I can make a DB query and call the $record->updated_at call? All help would be appreciated!
Please or to participate in this conversation.