In Laravel 5.6 when i try to Soft Delete all data in table with large records with my function:
public function clearActivityLog() {
$activities = Activity::all();
foreach ($activities as $activity) {
$activity->delete();
}
return redirect('admin/activity')
->with('success', trans('backend/main.logs.activity.messages.logClearedSuccessfuly'));
}
I get this error:
Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)