- Purchase 모델에 tax_invoice_received 필드 추가 - PurchaseService에 toggleTaxInvoice() 메서드 추가 - UpdatePurchaseRequest에 tax_invoice_received 검증 규칙 추가 - 마이그레이션: purchases 테이블에 tax_invoice_received 컬럼 추가
37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\V1\Purchase;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdatePurchaseRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'purchase_date' => ['sometimes', 'date'],
|
|
'client_id' => ['sometimes', 'integer', 'exists:clients,id'],
|
|
'supply_amount' => ['sometimes', 'numeric', 'min:0'],
|
|
'tax_amount' => ['sometimes', 'numeric', 'min:0'],
|
|
'total_amount' => ['sometimes', 'numeric', 'min:0'],
|
|
'description' => ['nullable', 'string', 'max:1000'],
|
|
'withdrawal_id' => ['nullable', 'integer', 'exists:withdrawals,id'],
|
|
'tax_invoice_received' => ['sometimes', 'boolean'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'client_id.exists' => __('validation.exists', ['attribute' => '거래처']),
|
|
'supply_amount.numeric' => __('validation.numeric', ['attribute' => '공급가액']),
|
|
'withdrawal_id.exists' => __('validation.exists', ['attribute' => '출금']),
|
|
];
|
|
}
|
|
}
|