46 lines
1.4 KiB
PHP
Executable File
46 lines
1.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Admin\Requests\ExpertManagement;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
/**
|
|
* @property mixed $expert
|
|
*/
|
|
class UpdateRequest 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, ValidationRule|array|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'username' => ['string', 'max:255',
|
|
Rule::unique('experts', 'username')->ignore($this->expert->id),],
|
|
'first_name' => 'string|max:255',
|
|
'last_name' => 'string|max:255',
|
|
'national_id' => ['string', 'max:20',
|
|
Rule::unique('experts', 'national_id')->ignore($this->expert->id),],
|
|
'password' => 'string|min:8|confirmed',
|
|
'email' => ['email', 'max:255',
|
|
Rule::unique('experts', 'email')->ignore($this->expert->id),],
|
|
'phone_number' => ['string', 'max:20',
|
|
Rule::unique('experts', 'phone_number')->ignore($this->expert->id),],
|
|
'province_id' => 'required|integer|exists:provinces,id',
|
|
'city_id' => 'required|integer|exists:cities,id',
|
|
];
|
|
}
|
|
}
|