Changes 0228092025 Laptop
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreContractRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$clientCase = $this->route('client_case');
|
||||
|
||||
return [
|
||||
'reference' => [
|
||||
'nullable',
|
||||
'string',
|
||||
'max:125',
|
||||
Rule::unique('contracts', 'reference')
|
||||
->where(fn ($q) => $q
|
||||
->where('client_case_id', optional($clientCase)->id)
|
||||
->whereNull('deleted_at')
|
||||
),
|
||||
],
|
||||
'start_date' => ['required', 'date'],
|
||||
'type_id' => ['required', 'integer', 'exists:contract_types,id'],
|
||||
'description' => ['nullable', 'string', 'max:255'],
|
||||
'initial_amount' => ['nullable', 'numeric'],
|
||||
'balance_amount' => ['nullable', 'numeric'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user