Implemented the authenticated admin contact system.

This commit is contained in:
2026-05-16 22:02:32 +03:30
parent 04e7931ccc
commit e633805ed3
28 changed files with 2200 additions and 14 deletions

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Http\Controllers;
use App\Models\SupportAttachment;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\StreamedResponse;
class SupportAttachmentController extends Controller
{
public function __invoke(Request $request, SupportAttachment $attachment): StreamedResponse
{
$attachment->loadMissing('message.conversation');
abort_unless(
$request->user()?->is_admin || $attachment->message->conversation->user_id === $request->user()?->id,
403,
);
return Storage::disk($attachment->disk)->download($attachment->path, $attachment->original_name);
}
}