fix: usar disco uploads en public/ para compatibilidad con cPanel sin symlinks
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -55,7 +55,7 @@ class ChatController extends Controller
|
||||
|
||||
if ($request->hasFile('attachment')) {
|
||||
$file = $request->file('attachment');
|
||||
$attachment = $file->store('chat', 'public');
|
||||
$attachment = $file->store('chat', 'uploads');
|
||||
$mime = $file->getMimeType();
|
||||
|
||||
if (str_starts_with($mime, 'image')) $attachmentType = 'image';
|
||||
|
||||
@@ -47,6 +47,15 @@ return [
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
'uploads' => [
|
||||
'driver' => 'local',
|
||||
'root' => public_path('uploads'),
|
||||
'url' => env('APP_URL').'/uploads',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
|
||||
@@ -27,17 +27,17 @@
|
||||
@endif
|
||||
@if($msg->attachment)
|
||||
@if($msg->attachment_type === 'image')
|
||||
<img src="{{ Storage::url($msg->attachment) }}" class="img-fluid rounded mt-1">
|
||||
<img src="{{ Storage::disk('uploads')->url($msg->attachment) }}" class="img-fluid rounded mt-1">
|
||||
@elseif($msg->attachment_type === 'audio')
|
||||
<audio controls class="mt-1" style="max-width:250px">
|
||||
<source src="{{ Storage::url($msg->attachment) }}">
|
||||
<source src="{{ Storage::disk('uploads')->url($msg->attachment) }}">
|
||||
</audio>
|
||||
@elseif($msg->attachment_type === 'video')
|
||||
<video controls class="mt-1 rounded" style="max-width:250px">
|
||||
<source src="{{ Storage::url($msg->attachment) }}">
|
||||
<source src="{{ Storage::disk('uploads')->url($msg->attachment) }}">
|
||||
</video>
|
||||
@else
|
||||
<a href="{{ Storage::url($msg->attachment) }}" target="_blank" class="btn btn-sm btn-light mt-1">
|
||||
<a href="{{ Storage::disk('uploads')->url($msg->attachment) }}" target="_blank" class="btn btn-sm btn-light mt-1">
|
||||
<i class="fas fa-file"></i> Ver archivo
|
||||
</a>
|
||||
@endif
|
||||
@@ -86,7 +86,7 @@
|
||||
<script>
|
||||
const receiverId = {{ $user->id }};
|
||||
const authId = {{ auth()->id() }};
|
||||
const storageBase = '{{ rtrim(Storage::url(''), '/') }}';
|
||||
const storageBase = '{{ rtrim(Storage::disk('uploads')->url(''), '/') }}';
|
||||
const chatMessages = document.getElementById('chat-messages');
|
||||
|
||||
// scroll al fondo
|
||||
|
||||
Reference in New Issue
Block a user