41 lines
1.6 KiB
PHP
41 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateOrderRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
$order = $this->route('commande');
|
|
return $this->user()->can('update', $order);
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'label' => ['required', 'string', 'max:255'],
|
|
'type' => ['required', 'string', 'in:Matériel réseau / serveur,Licences logicielles,Consommables / câblage,Prestations / services'],
|
|
'supplier' => ['required', 'string', 'max:255'],
|
|
'quote_number' => ['required', 'string', 'max:255'],
|
|
'amount_ht' => ['required', 'numeric', 'min:0'],
|
|
'exclude_vat' => ['nullable', 'boolean'],
|
|
'requested_by' => ['required', 'string', 'in:Jérémy,Sylvain,Kévin'],
|
|
'prescriber' => ['required', 'string', 'max:255'],
|
|
'delivery_deadline' => ['required', 'date'],
|
|
'notes' => ['nullable', 'string'],
|
|
'quote_file' => ['nullable', 'file', 'mimes:pdf,png,jpg,jpeg,doc,docx,xls,xlsx', 'max:10240'],
|
|
'delivery_note_file' => ['nullable', 'file', 'mimes:pdf,png,jpg,jpeg,doc,docx,xls,xlsx', 'max:10240'],
|
|
'invoice_file' => ['nullable', 'file', 'mimes:pdf,png,jpg,jpeg,doc,docx,xls,xlsx', 'max:10240'],
|
|
];
|
|
}
|
|
}
|