Laravel wydajny sposób na usunięcie rekordów X, jeśli są duplikaty

protected function deleteDuplicateApplications($hash = '', $skip = 5)
{
    // First get total count
    $totalCount = Application::where('hash', $hash)->count();

    // Then skip certain amount and take rest and delete it.
    return Application::where('hash', $hash)
                        ->orderBy('created_at', 'desc')
                        ->skip($skip)
                        ->take($totalCount - $skip)
                        ->delete();
}
SAMER SAEID