Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel Auth::TRUMENT()不起作用_Php_Mysql_Laravel - Fatal编程技术网

Php Laravel Auth::TRUMENT()不起作用

Php Laravel Auth::TRUMENT()不起作用,php,mysql,laravel,Php,Mysql,Laravel,这是我的登录功能: public function login() { $credentials = [ "username" => 'admin', "password" => 'abcde' ]; if (Auth::attempt($credentials)) { return 1; } else { re

这是我的登录功能:

   public function login()
    {
        $credentials = [
            "username" => 'admin',
            "password" => 'abcde'
        ];
        if (Auth::attempt($credentials)) {
            return 1;
        } else {
            return 0;
        }
    }
我认为代码很好,我确信用户名和密码是正确的,但它总是返回0。然后,我在代码中添加了一些错误来获取sql查询。我喜欢改变

"password" => 'abcde'

然后我得到了这个:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'passxxxword' in 'where clause' (SQL: select * from `admin_users` where `username` = admin and `passxxxword` = abcde limit 1).
正如我们所见,变量admin和abcde中缺少引号
这是为什么?

它不能显示2,因为在这段代码中只有1或0对不起,我的错误。我想说0为用户显示数据库中的记录您尝试登录的主要用户和密码您的密码是使用make hash函数保存到数据库的吗?除了默认情况下“users”表中的laravel auth query之外。您的表名为“admin\u users”。你改对了吗?
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'passxxxword' in 'where clause' (SQL: select * from `admin_users` where `username` = admin and `passxxxword` = abcde limit 1).