- UpdateSaleRequest: tax_invoice_issued, transaction_statement_issued 필드 추가 - SaleService: 토글 필드 업데이트 로직 추가 (canEdit 우회) - Sale 모델: fillable에 토글 필드 추가 - 마이그레이션: sales 테이블에 토글 컬럼 추가
38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\V1\Sale;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateSaleRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'sale_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'],
|
|
'deposit_id' => ['nullable', 'integer', 'exists:deposits,id'],
|
|
'tax_invoice_issued' => ['sometimes', 'boolean'],
|
|
'transaction_statement_issued' => ['sometimes', 'boolean'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'client_id.exists' => __('validation.exists', ['attribute' => '거래처']),
|
|
'supply_amount.numeric' => __('validation.numeric', ['attribute' => '공급가액']),
|
|
'deposit_id.exists' => __('validation.exists', ['attribute' => '입금']),
|
|
];
|
|
}
|
|
}
|