ahmadajah03 Sat Apr 2020 2 years ago

#1 Laravel Mongodb Basic Configuration and Authentication

This tutrial have a bugs which is there's error when you want to reset the user password. To fix the problem follow this step

in the User.php make sure that your code something like this

use Illuminate\Notifications\Notifiable;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Illuminate\Auth\Authenticatable as AuthenticableTrait;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Eloquent implements AuthenticatableContract, CanResetPasswordContract
use AuthenticableTrait;
use Notifiable;
use CanResetPassword;

protected $connection = 'mongodb';

and in the config/app.php, disable the default PasswordResetServiceProvider then add PasswordResetServiceProvider by Jenssgers
something like this

// Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
laravel mongodb laravel 5.8