Laravel-身份验证无法正常工作.超级怪异 [英] Laravel - Auth not working. super weird

查看:69
本文介绍了Laravel-身份验证无法正常工作.超级怪异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的身份验证,不起作用. Auth :: attempt 返回布尔值 false .我已经花了一个小时解决这个问题.我不知道我在做什么错.

Here's my authentication, it's not working. Auth::attempt returns bool false. I've spent an hour on this problem. I have no idea what I'm doing wrong.

Route::get('/test', function() 
{
    $user = new User();
    $user->email = 'cake@cake.com';
    $user->password = Hash::make('cake');
    $user->save();

    var_dump(Auth::attempt(array('email' => 'cake@cake.com', 'password' => 'cake')));
    die;
});

推荐答案

已解决.在删除用户模型上的默认方法时会出现问题.

Solved. The issue comes up when removing the default methods on the User model.

不会引发任何异常,它只会停止工作.事后看来很愚蠢.

No exceptions are thrown it just stops working. Stupid, in hindsight.

这篇关于Laravel-身份验证无法正常工作.超级怪异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆