where('unreachable_notification_sent', true)->where('updated_at', '<', now()->subDays(3))->get(); if ($servers->count() > 0) { foreach ($servers as $server) { echo "Cleanup unreachable server ($server->id) with name $server->name"; $server->update([ 'ip' => '1.2.3.4' ]); } } } }