当我尝试实现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);
}
}
答案 0 :(得分:1)
通过将Auth.php中的驱动程序从Eloquent更改为数据库
,错误消失了