API Rest with Laravel 5.6 Passport Authentication — Reset Password (Part 4)

Alfredo Barron
modulr
Published in
6 min readAug 2, 2018

--

We will learn to create a password reset system

https://www.vecteezy.com

Step 1. Update migration

In first step, we require to update the migration file database/migrations/xxx_create_password_resets_table.php like bellow code:

public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->increments('id');
$table->string('email')->index();
$table->string('token');
$table->timestamps();
});
}

Step 2. Create PasswordReset model

Open your terminal or command prompt and run bellow command:

php artisan make:model PasswordReset

This command will create app/PasswordReset.php file, in this file set fillable inputs.

class PasswordReset extends Model
{
protected $fillable = [
'email', 'token'
];

}

Step 3. Create Notifications

We create two notifications PaswordResetRequest and PasswordResetSuccess, in your terminal or command prompt run bellow commands:

php artisan make:notification PasswordResetRequestphp artisan

--

--