New-Thanasoft/thanasoft-back/app/Http/Requests/UpdateStockItemRequest.php

43 lines
1.0 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateStockItemRequest 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 [
'qty_on_hand_base' => 'sometimes|numeric|min:0',
'safety_stock_base' => 'sometimes|numeric|min:0',
];
}
/**
* Get the error messages for the defined validation rules.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'qty_on_hand_base.numeric' => 'La quantité en stock doit être un nombre.',
'safety_stock_base.numeric' => 'Le stock de sécurité doit être un nombre.',
];
}
}