DEV Community

Ndirangu Waweru
Ndirangu Waweru

Posted on

Hash passwords by default in Laravel

Update your user model

// App\Models\User

use Illuminate\Support\Facades\Hash;

...

/**
* Hash the password by default.
*/
public function setPasswordAttribute($password)
{
    $this->attributes['password'] = Hash::make($password);
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)