document_type, ApplicationDocument::ALLOWED_FOR_ADMIN, true), 403 ); abort_unless(Storage::disk($document->disk)->exists($document->path), 404); activity('documents') ->performedOn($document) ->causedBy(request()->user()) ->withProperties(['document_type' => $document->document_type]) ->log('document_downloaded_by_admin'); return Storage::disk($document->disk)->download($document->path, $document->original_name); } public function finance(ApplicationDocument $document): StreamedResponse { abort_unless( in_array($document->document_type, ApplicationDocument::ALLOWED_FOR_FINANCE, true), 403 ); abort_unless(Storage::disk($document->disk)->exists($document->path), 404); activity('documents') ->performedOn($document) ->causedBy(request()->user()) ->withProperties(['document_type' => $document->document_type]) ->log('bank_statement_downloaded_by_finance'); return Storage::disk($document->disk)->download($document->path, $document->original_name); } }