lundi 24 octobre 2016

CanResetPassword in User Model for Laravel 5.3

I am on the process of converting my app from Laravel 5.1 to 5.3. I am unsure on how to edit the CanResetPassword section in my User Model.

This is the user.php file in my laravel 5.1:

namespace App\Models;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, SoftDeletes, CanResetPassword;
    ...
}

Now, I am not sure what edits are required when changing it to Laravel 5.3.

Laravel 5.3 User model is like this:

namespace App\Models;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Database\Eloquent\SoftDeletes;

class User extends Authenticatable
{
    use Notifiable, SoftDeletes;
}

When I read the documentation, it said:

Before using the password reset features of Laravel, your user must use the Illuminate\Notifications\Notifiable trait.

Which is already there.

To get started, verify that your App\User model implements the Illuminate\Contracts\Auth\CanResetPassword contract. Of course, the App\User model included with the framework already implements this interface, and uses the Illuminate\Auth\Passwords\CanResetPassword trait to include the methods needed to implement the interface.

I don't understand that. From the quote above, does it mean that I do not need to include CanResetPassword since the User Model already implements this interface?

Can someone show me what edit I need to do to the User Model in Laravel 5.3 for this Password resets?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire