Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/nasirkhan/laravel-starter in…
Browse files Browse the repository at this point in the history
…to dev
  • Loading branch information
nasirkhan committed Dec 2, 2024
2 parents 8a19765 + cc6937c commit 21304f3
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions app/Http/Controllers/Frontend/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,27 +255,26 @@ public function changePassword()
*/
public function changePasswordUpdate(Request $request)
{
$id = auth()->user()->id;
$module_title = $this->module_title;
$module_name = $this->module_name;
$module_path = $this->module_path;
$module_icon = $this->module_icon;
$module_model = $this->module_model;
$module_name_singular = Str::singular($module_name);

if ($id !== auth()->user()->id) {
return redirect()->route('frontend.users.profile', encode_id(auth()->user()->id));
}
$module_action = 'change Password Update';

$request->validate($request, [
$validated = $request->validate([
'password' => 'required|confirmed|min:6',
]);

$module_name = $this->module_name;
$module_name_singular = Str::singular($this->module_name);

$$module_name_singular = auth()->user();

$request_data = $request->only('password');
$request_data['password'] = Hash::make($request_data['password']);
$validated['password'] = Hash::make($validated['password']);

$$module_name_singular->update($request_data);
$$module_name_singular->update($validated);

return redirect()->route('frontend.users.profile', encode_id(auth()->user()->id))->with('flash_success', 'Update successful!');
return redirect()->route('frontend.users.profile')->with('flash_success', 'Update successful!');
}

/**
Expand Down

0 comments on commit 21304f3

Please sign in to comment.