feat: [vehicle] 법인차량 사진 API 추가
- CorporateVehicle 모델 (photos 관계 포함) - VehiclePhotoService (R2 저장, 최대 10장 제한) - VehiclePhotoController (index/store/destroy) - StoreVehiclePhotoRequest (동적 max 검증) - finance.php 라우트 등록
This commit is contained in:
38
app/Http/Controllers/Api/V1/VehiclePhotoController.php
Normal file
38
app/Http/Controllers/Api/V1/VehiclePhotoController.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Finance\StoreVehiclePhotoRequest;
|
||||
use App\Services\Finance\VehiclePhotoService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class VehiclePhotoController extends Controller
|
||||
{
|
||||
public function __construct(private readonly VehiclePhotoService $service) {}
|
||||
|
||||
public function index(int $id): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->service->index($id),
|
||||
__('message.fetched')
|
||||
);
|
||||
}
|
||||
|
||||
public function store(StoreVehiclePhotoRequest $request, int $id): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->service->store($id, $request->file('files')),
|
||||
__('message.created')
|
||||
);
|
||||
}
|
||||
|
||||
public function destroy(int $id, int $fileId): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->service->destroy($id, $fileId),
|
||||
__('message.deleted')
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user