feat: complete register blade and controller

This commit is contained in:
2026-08-16 10:46:17 +03:30
parent b23842defd
commit d2f51a6e5c
15 changed files with 480 additions and 212 deletions
+110
View File
@@ -0,0 +1,110 @@
<?php
namespace App\Http\Requests;
use App\Enums\UserGender;
use App\Enums\UserMaritalStatus;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rules\Enum;
class RegisterPostRequest 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<mixed>|string>
*/
public function rules(): array
{
return [
'first_name' => [
'required',
'persian_alpha',
'min:2',
'max:100',
],
'last_name' => [
'required',
'persian_alpha',
'min:3',
'max:100',
],
'username' => [
'required',
'regex:/^[a-zA-Z0-9\x{0600}-\x{06FF}]+$/u',
'min:3',
'max:20',
'unique:users,username'
],
'national_code' => [
'required',
'ir_national_id',
'digits:10',
'unique:users,national_code',
],
'gender'=>[
'required',
new Enum(UserGender::class),
],
'marital_status'=>[
'required',
new Enum(UserMaritalStatus::class),
],
'spouse_name'=>[
'nullable',
'string',
'persian_alpha',
'max:256',
],
'image_id ' => [
'nullable',
'image',
'mimes:jpg,jpeg,png,webp',
'max:800',
],
'province_id' => [
'nullable',
'exists:provinces,id',
],
'city_id' => [
'nullable',
'exists:cities,id',
],
'password' => [
'required',
'string',
'min:6',
'max:255',
'confirmed'
],
'mobile' => [
'required',
'ir_mobile:zero',
'unique:users,mobile',
],
'email' => [
'required',
'max:150',
'email',
'unique:users,mobile', ]
];
}
}