develop
Last change
on this file since 507ade0 was e6c1f87, checked in by beratkjufliju <kufliju@…>, 3 years ago |
added pagination, is_important
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[194a359] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | namespace App\Http\Requests\Dashboard;
|
---|
| 4 |
|
---|
| 5 | use Illuminate\Foundation\Http\FormRequest;
|
---|
[bd9e8e3] | 6 | use Illuminate\Contracts\Validation\Validator;
|
---|
| 7 | use Illuminate\Validation\ValidationException;
|
---|
[194a359] | 8 |
|
---|
| 9 | class UsernameSettingsRequest extends FormRequest
|
---|
| 10 | {
|
---|
| 11 | /**
|
---|
| 12 | * Determine if the user is authorized to make this request.
|
---|
| 13 | *
|
---|
| 14 | * @return bool
|
---|
| 15 | */
|
---|
| 16 | public function authorize()
|
---|
| 17 | {
|
---|
| 18 | return true;
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | /**
|
---|
| 22 | * Get the validation rules that apply to the request.
|
---|
| 23 | *
|
---|
| 24 | * @return array
|
---|
| 25 | */
|
---|
| 26 | public function rules()
|
---|
| 27 | {
|
---|
| 28 | return [
|
---|
[d795fa6] | 29 | "username" => "required|alpha_dash|min:5|unique:users,username,$this->id,id"
|
---|
[194a359] | 30 | ];
|
---|
| 31 | }
|
---|
[bd9e8e3] | 32 |
|
---|
| 33 | protected function failedValidation(Validator $validator)
|
---|
| 34 | {
|
---|
| 35 | $response = redirect()
|
---|
| 36 | ->route('dashboard.settings.index')
|
---|
[e6c1f87] | 37 | ->withInput(['active_tab' => 'security'])
|
---|
[bd9e8e3] | 38 | ->withErrors($validator);
|
---|
| 39 |
|
---|
[e6c1f87] | 40 | throw (new ValidationException($validator))
|
---|
[bd9e8e3] | 41 | ->errorBag($this->errorBag)
|
---|
| 42 | ->redirectTo($this->getRedirectUrl());
|
---|
| 43 | }
|
---|
[194a359] | 44 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.