delete(); $this->withProgressBar( Storage::disk('attachments')->allFiles('projects'), function ($filePath) use ($service) { $fileName = Str::of($filePath)->basename()->toString(); if (Attachment::whereId($fileName)->exists() === false) { SusFiles::create([ 'path' => $filePath, 'mime_type' => $service->getMimeType($filePath), 'hash' => $service->getHashSum($filePath), ]); } } ); } }