diff --git a/app/Http/Controllers/ChatController.php b/app/Http/Controllers/ChatController.php index 49372303..447b6091 100644 --- a/app/Http/Controllers/ChatController.php +++ b/app/Http/Controllers/ChatController.php @@ -55,7 +55,7 @@ class ChatController extends Controller if ($request->hasFile('attachment')) { $file = $request->file('attachment'); - $attachment = $file->store('chat', 'uploads'); + $attachment = $file->store('chat', 'local'); $mime = $file->getMimeType(); if (str_starts_with($mime, 'image')) $attachmentType = 'image'; diff --git a/app/Http/Controllers/FileController.php b/app/Http/Controllers/FileController.php new file mode 100644 index 00000000..cd81e13a --- /dev/null +++ b/app/Http/Controllers/FileController.php @@ -0,0 +1,24 @@ +exists($path)) { + abort(404); + } + + return Storage::disk('local')->response($path); + } +} diff --git a/config/filesystems.php b/config/filesystems.php index 21cd5774..b27ea19d 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -49,7 +49,7 @@ return [ 'uploads' => [ 'driver' => 'local', - 'root' => public_path('uploads'), + 'root' => env('UPLOADS_DISK_ROOT', public_path('uploads')), 'url' => env('APP_URL').'/uploads', 'visibility' => 'public', 'throw' => false, diff --git a/resources/views/chat/show.blade.php b/resources/views/chat/show.blade.php index 1af3538b..3657ca9c 100644 --- a/resources/views/chat/show.blade.php +++ b/resources/views/chat/show.blade.php @@ -27,17 +27,17 @@ @endif @if($msg->attachment) @if($msg->attachment_type === 'image') - + @elseif($msg->attachment_type === 'audio') @elseif($msg->attachment_type === 'video') @else - + Ver archivo @endif @@ -86,7 +86,7 @@