2025-08-22 19:30:05 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Api\V1;
|
|
|
|
|
|
2025-11-06 17:45:49 +09:00
|
|
|
use App\Helpers\ApiResponse;
|
2025-08-22 19:30:05 +09:00
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use App\Services\ClassificationService;
|
2025-11-06 17:45:49 +09:00
|
|
|
use Illuminate\Http\Request;
|
2025-08-22 19:30:05 +09:00
|
|
|
|
|
|
|
|
class ClassificationController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function __construct(private ClassificationService $service) {}
|
|
|
|
|
|
|
|
|
|
public function index(Request $request)
|
|
|
|
|
{
|
2025-11-06 17:45:49 +09:00
|
|
|
return ApiResponse::handle(fn () => $this->service->index($request->all()), '분류 목록 조회');
|
2025-08-22 19:30:05 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function show(string $id)
|
|
|
|
|
{
|
2025-11-06 17:45:49 +09:00
|
|
|
return ApiResponse::handle(fn () => $this->service->show((int) $id), '분류 단건 조회');
|
2025-08-22 19:30:05 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function store(Request $request)
|
|
|
|
|
{
|
2025-11-06 17:45:49 +09:00
|
|
|
return ApiResponse::handle(fn () => $this->service->store($request->all()), '분류 생성');
|
2025-08-22 19:30:05 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function update(string $id, Request $request)
|
|
|
|
|
{
|
2025-11-06 17:45:49 +09:00
|
|
|
return ApiResponse::handle(fn () => $this->service->update((int) $id, $request->all()), '분류 수정');
|
2025-08-22 19:30:05 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function destroy(string $id)
|
|
|
|
|
{
|
2025-11-06 17:45:49 +09:00
|
|
|
return ApiResponse::handle(fn () => $this->service->destroy((int) $id), '분류 삭제');
|
2025-08-22 19:30:05 +09:00
|
|
|
}
|
|
|
|
|
}
|