Files
nnterp-react-admin/app/Http/Requests/ProfileUpdateRequest.php
2026-03-13 20:49:46 +08:00

27 lines
870 B
PHP

<?php
namespace App\Http\Requests;
use App\Models\User;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ProfileUpdateRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)],
'mobile_no' => ['nullable', 'string', 'max:20'],
'avatar' => ['required', 'string', 'max:500'],
'slug' => ['nullable', 'string', 'max:255', 'regex:/^[a-z0-9-]+$/', Rule::unique(User::class)->ignore($this->user()->id)],
];
}
}