2025-11-20 17:16:03 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Api\V1\ItemMaster;
|
|
|
|
|
|
2025-11-27 15:51:00 +09:00
|
|
|
use App\Helpers\ApiResponse;
|
2025-11-20 17:16:03 +09:00
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use App\Http\Requests\ItemMaster\UnitOptionStoreRequest;
|
|
|
|
|
use App\Services\ItemMaster\UnitOptionService;
|
|
|
|
|
|
|
|
|
|
class UnitOptionController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function __construct(
|
|
|
|
|
protected UnitOptionService $service,
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 단위 옵션 목록
|
|
|
|
|
*/
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
|
|
|
|
return ApiResponse::handle(function () {
|
|
|
|
|
return $this->service->index();
|
|
|
|
|
}, __('message.fetched'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 단위 옵션 생성
|
|
|
|
|
*/
|
|
|
|
|
public function store(UnitOptionStoreRequest $request)
|
|
|
|
|
{
|
|
|
|
|
return ApiResponse::handle(function () use ($request) {
|
|
|
|
|
return $this->service->store($request->validated());
|
|
|
|
|
}, __('message.created'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 단위 옵션 삭제
|
|
|
|
|
*/
|
|
|
|
|
public function destroy(int $id)
|
|
|
|
|
{
|
|
|
|
|
return ApiResponse::handle(function () use ($id) {
|
|
|
|
|
$this->service->destroy($id);
|
|
|
|
|
|
|
|
|
|
return 'success';
|
|
|
|
|
}, __('message.deleted'));
|
|
|
|
|
}
|
|
|
|
|
}
|