- 마이그레이션: purchases 테이블에 purchase_type 컬럼 추가 - Purchase 모델: $fillable 및 PURCHASE_TYPES 상수 추가 - StorePurchaseRequest: purchase_type validation 추가 - UpdatePurchaseRequest: purchase_type validation 추가 - PurchaseService: store/update에 purchase_type 처리 추가 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
41 lines
1.5 KiB
PHP
41 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\V1\Purchase;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StorePurchaseRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'purchase_date' => ['required', 'date'],
|
|
'client_id' => ['required', 'integer', 'exists:clients,id'],
|
|
'supply_amount' => ['required', 'numeric', 'min:0'],
|
|
'tax_amount' => ['required', 'numeric', 'min:0'],
|
|
'total_amount' => ['required', 'numeric', 'min:0'],
|
|
'purchase_type' => ['nullable', 'string', 'max:50'],
|
|
'description' => ['nullable', 'string', 'max:1000'],
|
|
'withdrawal_id' => ['nullable', 'integer', 'exists:withdrawals,id'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'purchase_date.required' => __('validation.required', ['attribute' => '매입일자']),
|
|
'client_id.required' => __('validation.required', ['attribute' => '거래처']),
|
|
'client_id.exists' => __('validation.exists', ['attribute' => '거래처']),
|
|
'supply_amount.required' => __('validation.required', ['attribute' => '공급가액']),
|
|
'supply_amount.numeric' => __('validation.numeric', ['attribute' => '공급가액']),
|
|
'tax_amount.required' => __('validation.required', ['attribute' => '세액']),
|
|
'total_amount.required' => __('validation.required', ['attribute' => '합계']),
|
|
];
|
|
}
|
|
}
|