mirror of
https://codeberg.org/JasterV/social-network-api.git
synced 2026-04-26 18:10:07 +00:00
37 lines
991 B
PHP
37 lines
991 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class RegisterUserRequest extends ApiRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'name' => 'required|string',
|
|
'username' => 'required|unique:users|regex:/^(?=[a-zA-Z0-9._]{3,20}$)(?!.*[_.]{2})[^_.].*[^_.]$/',
|
|
'email' => 'required|email|unique:users',
|
|
'password' => 'required',
|
|
'c_password' => 'required|same:password',
|
|
'gender' => 'required|in:man,woman,non-binary',
|
|
'marital_status' => 'required|in:married,single,widow,divorced,complicated,relationship,swinger',
|
|
'date_of_birth' => 'required|date'
|
|
];
|
|
}
|
|
}
|