diff --git a/.gitignore b/.gitignore index a3b3c0fe2..522f67764 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ bower_components .php_cs.cache storage/debugbar/ public/build/ +storage/ diff --git a/app/Http/Controllers/DocumentsController.php b/app/Http/Controllers/DocumentsController.php index 7fb7705ce..be373aca0 100644 --- a/app/Http/Controllers/DocumentsController.php +++ b/app/Http/Controllers/DocumentsController.php @@ -68,7 +68,7 @@ public function upload(Request $request, $external_id) session()->flash('flash_message_warning', __('You do not have permission to upload a document')); return redirect()->route('tasks.show', $external_id); } - $client = Client::whereExternalId($external_id)->first(); + $client = Client::whereExternalId($external_id); $file = $request->file('file'); $filename = str_random(8) . '_' . $file->getClientOriginalName(); diff --git a/app/Services/Storage/Local.php b/app/Services/Storage/Local.php index 4ff023d0b..c56981be9 100644 --- a/app/Services/Storage/Local.php +++ b/app/Services/Storage/Local.php @@ -1,33 +1,38 @@ put($client_folder, $file); + + return ['file_path' => $client_folder . '/' . $file->hashName()]; } public function delete($full_path): bool { - return true; + return Storage::disk('local')->delete($full_path); } public function view($file) { - // TODO: Implement view() method. + return $this->download($file); } public function download($file) { - // TODO: Implement download() method. + $fileData = Storage::disk('local')->get($file->path); + return $fileData; } public function revokeAccess()