Laravel 5 Auth ::由自定义控制器尝试

时间:2015-06-18 13:16:10

标签: php laravel-5

当我尝试实现Auth :: attempt()

时,得到以下错误

我看起来像

的控制器
 Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\Models\User given

我看起来像

的控制器
<?php namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Support\Facades\Auth;
use Illuminate\Contracts\Auth\Authenticable;
use Illuminate\Auth\UserInterface;



class AdminAjaxController extends Controller {
    public function getLogin()
    {
        $data = array('email' => Input::get('email'), 'password' =>Input::get('password'));
        Auth::attempt($data);
    }
}

1 个答案:

答案 0 :(得分:1)

通过将Auth.php中的驱动程序从Eloquent更改为数据库

,错误消失了