php

Changing Your Authentication Model

Problem

You need the change the authentication model from the default User.

Your application is using namespaces or you want to use a differently named model for users.

Solution

Edit app/config/auth.php to change the model.

    'model' => 'MyApp\Models\User',

Discussion

Don’t forget the required interfaces.

If you’re using your own model it’s important that your model implements Auth’s UserInterface. If you’re implementing the password reminder feature it should also implement RemindableInterface.

<?php namespace MyApp\Models;

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

class User extends \Eloquent implements UserInterface, RemindableInterface
{
    ...
}

About the author

laravelrecipies