develop
Last change
on this file since e651d0d was d795fa6, checked in by Berat Kjufliju <kufliju@…>, 3 years ago |
added validation to blades
|
-
Property mode
set to
100644
|
File size:
898 bytes
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | namespace App\Http\Requests\Dashboard;
|
---|
4 |
|
---|
5 | use Illuminate\Foundation\Http\FormRequest;
|
---|
6 | use Illuminate\Support\Facades\Hash;
|
---|
7 |
|
---|
8 | class PasswordSettingsRequest extends FormRequest
|
---|
9 | {
|
---|
10 | /**
|
---|
11 | * Determine if the user is authorized to make this request.
|
---|
12 | *
|
---|
13 | * @return bool
|
---|
14 | */
|
---|
15 | public function authorize()
|
---|
16 | {
|
---|
17 | return true;
|
---|
18 | }
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Get the validation rules that apply to the request.
|
---|
22 | *
|
---|
23 | * @return array
|
---|
24 | */
|
---|
25 | public function rules()
|
---|
26 | {
|
---|
27 | return [
|
---|
28 | "current_password" => [
|
---|
29 | "required",
|
---|
30 | function($attribute, $value, $fail) {
|
---|
31 | if(!Hash::check($value, auth()->user()->password)) {
|
---|
32 | $fail("Current password is invalid.");
|
---|
33 | }
|
---|
34 | }
|
---|
35 | ],
|
---|
36 | "password" => "required|string|confirmed|min:6",
|
---|
37 | ];
|
---|
38 | }
|
---|
39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.