Question By
Unsolved

Laravel 5.2 User Settings

mochinbn-bounouara

Aug 31st, 2016 08:13 AM

<p>Please can help me to add User Settings, specialy change password in laravel 5.2 ??</p>
tnylea

Aug 31st, 2016 12:35 PM

<p>Hey Mochinbn-bounouara,</p> <p>Do you already have a form where the user can update their settings.</p> <p>I know one easy way you can do this is to set the password to only reset if it has changed. So, in your function you would do something like the following:&nbsp;</p> <pre class="language-php"><code>&lt;?php

public function update($request, $id){ // Perform your validation

$user = User::find($id);  

if ($request-&gt;password == '') {
    $request-&gt;password = $user-&gt;password;
} else {
    $request-&gt;password = Hash::make($request-&gt;password);
}

$user-&gt;update($request);

// return back to route letting user know that they have successfully updated their account.

}</code></pre>

<p>Let me know if that helps or if you need further assistance :)</p>