PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Unsolved

Laravel 5.2 User Settings

mochinbn-bounouara

Aug 31st, 2016 08:13 AM

Please can help me to add User Settings, specialy change password in laravel 5.2 ??

tnylea

Aug 31st, 2016 12:35 PM

Hey Mochinbn-bounouara,

Do you already have a form where the user can update their settings.

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: 

<?php
<p>public function update($request, $id){
// Perform your validation</p>
<pre><code>$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.

}

Let me know if that helps or if you need further assistance :)