31 lines
1.6 KiB
PHP
31 lines
1.6 KiB
PHP
<?php
|
||
|
||
namespace Modules\ClientCreateForm\Http\Livewire;
|
||
|
||
use Livewire\Attributes\Validate;
|
||
use Livewire\Form;
|
||
|
||
class ClientCreateForm extends Form
|
||
{
|
||
public $currentClient;
|
||
protected $messages = [
|
||
'clients.*.firstName.required' => 'Необходимо указать имя клиента',
|
||
'clients.*.secondName.required' => 'Необходимо указать фамилию клиента',
|
||
'clients.*.phones.*.required' => 'Необходимо указать телефон',
|
||
'clients.*.phones.*.regex' => 'Телефон должен быть в международном формате',
|
||
'clients.*.phones.*.unique' => 'Клиент с таким телефоном уже существует',
|
||
'agent.integer' => 'Необходимо указать агента, от которого добавляется контакт'
|
||
];
|
||
protected function rules()
|
||
{
|
||
return [
|
||
//'agent' => ['required', 'integer'],
|
||
//'currentClient' => ['required', 'string', 'max:255'],
|
||
'currentClient.firstName' => ['required', 'string', 'max:255'],
|
||
'currentClient.secondName' => ['required', 'string', 'max:255'],
|
||
'currentClient.phones.*' => ['required', 'string', 'regex:/^(\+7)([0-9]{3})([-]{1})([0-9]{3})([-]{1})([0-9]{4})/i']
|
||
//'client.phone' => ['required', 'string', 'regex:/^\+7 \d{3} \d{3}-\d{2}-\d{2}$/'],
|
||
//'client.phone' => ['required', 'string']
|
||
];
|
||
}
|
||
} |