50 lines
1.6 KiB
PHP
50 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\V3\Dashboard\UserManagement;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class FullStoreRequest 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 [
|
|
'edarate_ostani_id' => [
|
|
'integer', 'exists:edarate_ostani,id',
|
|
Rule::prohibitedIf(fn () => filled($this->input('edarate_shahri_id'))),
|
|
],
|
|
'edarate_shahri_id' => [
|
|
'integer', 'exists:edarate_shahri,id',
|
|
Rule::prohibitedIf(fn () => filled($this->input('edarate_ostani_id'))),
|
|
],
|
|
'province_id' => 'required|exists:provinces,id',
|
|
'city_id' => 'exists:cities,id',
|
|
'username' => 'required|unique:users,username',
|
|
'national_code' => 'unique:users,national_code|digits:10',
|
|
'password' => 'required|confirmed|min:8',
|
|
'first_name' => 'required|string',
|
|
'last_name' => 'required|string',
|
|
'position' => 'string',
|
|
'mobile' => 'required|regex:/^09\d{9}$/|numeric|digits:11',
|
|
'degree' => 'string',
|
|
'major' => 'string',
|
|
'avatar' => 'required|file|mimes:pdf,jpg,jpeg,png',
|
|
];
|
|
}
|
|
}
|