我正在为我的项目使用laravel 5.1 . 我试图验证我的内置模型而不是laravel自己的用户模型 .

My model name is Registration_Model
my table is registration

Laravel 5.1 multiple authentication我做了他说的话 . auth.php文件是

return [
'multi' => [
        'user' => [
        'driver' => 'eloquent',
        'model'  => App\User::class,
        'table'  => 'users'
    ],
    'registration' => [
        'driver' => 'eloquent',
        'model'  => App\Registration_Model::class, // Model Class
        'table'  => 'registration' // registration table
    ],
 ],
 'password' => [
       'email' => 'emails.password',
       'table' => 'password_resets',
       'expire' => 60,
  ]
 ];

我的route.php文件是

Route::resource('/', 'RegistrationController');
Route::get('register', function () {
    return view('project.register');
});
Route::post('route_register','RegistrationController@store');

// Authentication routes...
Route::get('auth/login', 'Auth\AuthRegistrationController@getLogin');
Route::post('auth/login', 'Auth\AuthRegistrationController@postLogin');
// Route::post('auth/login', 'Auth\AuthController@authenticate');
Route::get('auth/logout', 'Auth\AuthRegistrationController@getLogout');

// Registration routes...
Route::get('auth/register', 'Auth\AuthRegistrationController@getRegister');
Route::post('auth/register','Auth\AuthRegistrationController@postRegister');

和我的AuthRegistrationController.php文件是

<?php

namespace App\Http\Controllers\Auth;

use App\User;
use Validator;
use App\Http\Requests\Request;
use Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
use App\Http\Controllers\RegistrationController;
use App\Registration_Model;

class AuthRegistrationController extends Controller
{

    use AuthenticatesAndRegistersUsers, ThrottlesLogins;  

    public function __construct()
    {
        $this->middleware('guest', ['except' => 'getLogout']);
    }  

    protected function validator(array $data)
    {
        return Validator::make($data, [

            'email' => 'required|email|max:255|unique:registration',
            'password' => 'required|confirmed|min:3',
        ]);
    }

    protected function create(array $data)
    {
        return Registration_Model::create([

            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);
    }

    protected $redirectPath = 'register'; 
    protected $loginPath = '/auth/login';
}

我在尝试注册时收到错误消息 .

Guard.php第430行中的ErrorException:传递给Illuminate \ Auth \ Guard :: login()的参数1必须是Illuminate \ Contracts \ Auth \ Authenticatable的实例,给出App \ Registration_Model的实例 . 当我在EloquentUserProvider.php第110行尝试登录ErrorException时收到错误信息:传递给Illuminate \ Auth \ EloquentUserProvider :: validateCredentials()的参数1必须是Illuminate \ Contracts \ Auth \ Authenticatable的实例,给出的App \ Registration_Model实例,在C:\ xampp \ htdocs \ project_2016 \ vendor \ laravel \ framework \ src \ Illuminate中调用

第390行上的\ Auth \ Guard.php并已定义,我的Registration_Model就在这里

<?php

    namespace App;

    use Illuminate\Database\Eloquent\Model;

    class Registration_Model extends Model
    {
         protected  $table = "registration";
        protected $primaryKey = "reg_id";

        protected $fillable = ['email','password'];
    }