Файловый менеджер - Редактировать - /home/clickysoft/public_html/securebeans.clickysoft.net/app/Http/Requests/UpdateProfileRequest.php
Назад
<?php namespace App\Http\Requests; use Gate; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Http\Response; use App\Models\User; class UpdateProfileRequest extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { // abort_if(Gate::denies('profile_edit'), Response::HTTP_FORBIDDEN, '403 Forbidden'); return true; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'name' => [ 'required', // 'regex:/^[\pL\s\-]+$/u', // 'regex:/(^([a-zA-Z]+)(\d+)?$)/u', 'string', 'max:25' ], // 'email' => ['required', 'string', 'email', 'max:255', 'unique:users,email,' . auth()->id()], 'email'=> ['required_if:auth()->id(),==,34','regex:/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix','max:255', 'unique:users', function ($attribute, $value, $fail) { foreach(User::all() as $user){ if ($value === $user['email'] && auth()->id() != $user['id']) { $fail('This email is already taken.'); } } }, ], ]; } public function messages(){ return [ 'email.required_if' => 'This cannot be blank', 'email.regex' => 'Invalid email', ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка