Skip to content
This repository was archived by the owner on Mar 12, 2024. It is now read-only.

Commit 1be85e4

Browse files
committed
formatting
1 parent 1c1aeeb commit 1be85e4

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/Http/Livewire/User.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class User extends Component
1919
protected function rules()
2020
{
2121
return [
22-
'user.name' => 'required|string',
23-
'user.email' => ['required', 'email', 'not_in:' . $this->user->id],
22+
'user.name' => 'required|string',
23+
'user.email' => ['required', 'email', 'not_in:' . $this->user->id],
2424
];
2525
}
2626

@@ -54,16 +54,19 @@ public function updateUser()
5454
public function updatePassword()
5555
{
5656
$validatedData = $this->validate([
57-
'credentials.password' => 'required|confirmed',
58-
'credentials.password_confirmation' => 'required'
59-
]);
57+
'credentials.password' => 'required|confirmed',
58+
'credentials.password_confirmation' => 'required'
59+
] + $this->rules());
60+
6061
$this->user->forceFill([
6162
'password' => \Illuminate\Support\Facades\Hash::make($this->credentials['password']),
6263
])->save();
63-
Auth::login($this->user);
6464

65-
}
65+
//if edited user is same as logged in user
66+
if ($this->user->id == auth()->user()->id)
67+
Auth::login($this->user);
6668

69+
}
6770

6871

6972
}

0 commit comments

Comments
 (0)