Conditions | 2 |
Paths | 2 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function update(Request $request) |
||
18 | { |
||
19 | if (Hash::check($request->old_password, Auth::user()->password)) { |
||
|
|||
20 | $request->validate([ |
||
21 | 'new_password' => 'required|confirmed|min:6', |
||
22 | ]); |
||
23 | |||
24 | $user = Auth::user(); |
||
25 | $user->password = Hash::make($request->new_password); |
||
26 | $user->save(); |
||
27 | |||
28 | Auth::logout(); |
||
29 | |||
30 | return redirect()->route('admins.login'); |
||
31 | }else{ |
||
32 | Session::flash('message', 'Old Password Does not match!'); |
||
33 | Session::flash('alert-class', 'alert-danger'); |
||
34 | return redirect()->back(); |
||
35 | } |
||
36 | } |
||
37 | |||
39 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: