40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreQuoteLineRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'quote_id' => 'required|exists:quotes,id',
|
|
'product_id' => 'nullable|exists:products,id',
|
|
'packaging_id' => 'nullable|exists:product_packagings,id',
|
|
'packages_qty' => 'nullable|numeric|min:0',
|
|
'units_qty' => 'nullable|numeric|min:0',
|
|
'description' => 'required|string',
|
|
'qty_base' => 'nullable|numeric|min:0',
|
|
'unit_price' => 'required|numeric|min:0',
|
|
'unit_price_per_package' => 'nullable|numeric|min:0',
|
|
'tva_rate_id' => 'nullable|exists:tva_rates,id',
|
|
'discount_pct' => 'required|numeric|min:0|max:100',
|
|
'total_ht' => 'required|numeric|min:0',
|
|
];
|
|
}
|
|
}
|