Files
sam-api/app/Http/Requests/Bidding/BiddingStoreRequest.php

56 lines
2.0 KiB
PHP
Raw Normal View History

<?php
namespace App\Http\Requests\Bidding;
use App\Models\Bidding\Bidding;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class BiddingStoreRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
// 견적 연결 (선택사항)
'quote_id' => ['nullable', 'integer', 'exists:quotes,id'],
// 거래처/현장
'client_id' => ['nullable', 'integer'],
'client_name' => ['nullable', 'string', 'max:100'],
'project_name' => ['required', 'string', 'max:200'],
// 입찰 정보
'bidding_date' => ['nullable', 'date'],
'bid_date' => ['nullable', 'date'],
'submission_date' => ['nullable', 'date'],
'confirm_date' => ['nullable', 'date'],
'total_count' => ['nullable', 'integer', 'min:0'],
'bidding_amount' => ['nullable', 'numeric', 'min:0'],
// 상태 (기본값: waiting)
'status' => ['nullable', 'string', Rule::in(Bidding::STATUSES)],
// 입찰자
'bidder_id' => ['nullable', 'integer'],
'bidder_name' => ['nullable', 'string', 'max:50'],
// 공사기간
'construction_start_date' => ['nullable', 'date'],
'construction_end_date' => ['nullable', 'date', 'after_or_equal:construction_start_date'],
'vat_type' => ['nullable', 'string', Rule::in(Bidding::VAT_TYPES)],
// 비고
'remarks' => ['nullable', 'string'],
// 견적 데이터 스냅샷 (견적에서 전환 시)
'expense_items' => ['nullable', 'array'],
'estimate_detail_items' => ['nullable', 'array'],
];
}
public function messages(): array
{
return [
'project_name.required' => __('validation.required', ['attribute' => '현장명']),
'quote_id.exists' => __('validation.exists', ['attribute' => '견적']),
];
}
}