36 lines
1.1 KiB
PHP
36 lines
1.1 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'],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function messages(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'client_id.exists' => __('validation.exists', ['attribute' => '거래처']),
|
||
|
|
'supply_amount.numeric' => __('validation.numeric', ['attribute' => '공급가액']),
|
||
|
|
'withdrawal_id.exists' => __('validation.exists', ['attribute' => '출금']),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|