我使用laravel 5.0
并且我无法验证登录信息
如果我输入错误的电子邮件/通行证匹配,它会重定向我完美
但是当我输入正确的电子邮件/通行证时,它会将此返回给我:
传递给Illuminate \ Auth \ EloquentUserProvider :: validateCredentials()的参数1必须是Illuminate \ Contracts \ Auth \ Authenticatable的实例,App \ User的实例给出...
我跟随documentation,看起来一切都很好。
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class User extends Model {
}
public function postsignin(Request $request)
{
if( Auth::attempt( ['email' => $request['email'], 'password' => $request['password'] ] ) )
return redirect()->route('dashboard');
return redirect()->back();
}
不知道它是什么。
答案 0 :(得分:1)
尝试实现AuthenticatableContract和Authenticatable特征
<?php namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
class User extends Model implements AuthenticatableContract{
use Authenticatable
}