New-Thanasoft/thanasoft-back/app/Http/Requests/StoreClientGroupRequest.php
nyavokevin 9cbc1bcbdb feat(ui): add price lists and group-based quote flows
Add price list management across the API, store, services, routes,
navigation, and sales views.

Support quotes for either a client or a client group, including PDF
download and nullable client validation for group-based recipients.

Extend client groups to manage assigned clients directly from the form
and detail views, and refresh supplier, intervention, stock, and order
screens with updated interactions and layouts.
2026-04-02 12:07:11 +03:00

47 lines
1.6 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreClientGroupRequest 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 [
'name' => 'required|string|max:191|unique:client_groups,name',
'description' => 'nullable|string',
'client_ids' => 'sometimes|array',
'client_ids.*' => 'integer|distinct|exists:clients,id',
];
}
public function messages(): array
{
return [
'name.required' => 'Le nom du groupe est obligatoire.',
'name.string' => 'Le nom du groupe doit être une chaîne de caractères.',
'name.max' => 'Le nom du groupe ne peut pas dépasser 191 caractères.',
'name.unique' => 'Un groupe avec ce nom existe déjà.',
'description.string' => 'La description doit être une chaîne de caractères.',
'client_ids.array' => 'La liste des clients doit être un tableau.',
'client_ids.*.integer' => 'Chaque ID client doit être un entier.',
'client_ids.*.distinct' => 'Un client ne peut pas être sélectionné plusieurs fois.',
'client_ids.*.exists' => 'Un ou plusieurs clients sélectionnés sont introuvables.',
];
}
}