- Added `media-library.php` configuration file for managing media uploads and conversions. - Updated `filesystems.php` to set default visibility for AWS S3 storage. - Implemented `FileUpload` component for handling file uploads with preview and error handling. - Created `ImagePreviewModal` component for displaying image previews in a modal. - Introduced `Attachment` UI components for better file attachment handling. - Added `useFileUpload` hook to manage file upload state and logic. - Implemented utility functions for uploading files to S3 with presigned URLs. - Created API route for generating presigned URLs for file uploads.
29 lines
687 B
PHP
29 lines
687 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\Api\PresignedUrlRequest;
|
|
use App\Services\S3PresignedService;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
class PresignedUrlController extends Controller
|
|
{
|
|
public function __construct(
|
|
private S3PresignedService $service
|
|
) {}
|
|
|
|
public function store(PresignedUrlRequest $request): JsonResponse
|
|
{
|
|
$validated = $request->validated();
|
|
|
|
$result = $this->service->createUploadUrl(
|
|
$validated['file_name'],
|
|
$validated['mime_type'],
|
|
$validated['folder'] ?? null,
|
|
);
|
|
|
|
return response()->json($result);
|
|
}
|
|
}
|