duandu1377 2015-06-18 13:16
浏览 70
已采纳

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

Am getting the below error, when I try to implement Auth::attempt()

The controller I have looks like

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

The controller I have looks like

<?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条回答 默认 最新

  • duanshang9426 2015-06-19 11:50
    关注

    The error gone by changing the driver in Auth.php from Eloquent to Database

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?