67 lines
1.5 KiB
PHP
67 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class EditProfilePostRequest 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
|
|
{
|
|
// دریافت آیدی کاربر از طریق سشن لاگین
|
|
$userId = auth()->id();
|
|
|
|
return [
|
|
|
|
'first_name' =>
|
|
[
|
|
'required',
|
|
'string',
|
|
'max:100'
|
|
],
|
|
'last_name' =>
|
|
[
|
|
'required',
|
|
'string',
|
|
'max:100'
|
|
],
|
|
'username' =>
|
|
[
|
|
'required',
|
|
'string',
|
|
'max:50',
|
|
'unique:users,username,' . $userId,
|
|
],
|
|
'email' => [
|
|
'required',
|
|
'email',
|
|
'max:150',
|
|
'unique:users,email,' . $userId,
|
|
],
|
|
'password' =>
|
|
|
|
[
|
|
'nullable',
|
|
'string',
|
|
'min:8',
|
|
'confirmed'
|
|
],
|
|
|
|
];
|
|
}
|
|
}
|