Hash :: make无法正常工作route.php文件 [英] Hash::make not working route.php file

查看:43
本文介绍了Hash :: make无法正常工作route.php文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的新laravel 4应用程序出现身份验证问题. 我注意到了一件奇怪的事情,这可能就是为什么当我这样做的时候:

var_dump(Hash::check('secret', Hash::make('secret')));

在数据库播种机(在其中创建我的哈希密码)中,我得到了真相.

当我直接在路由中运行相同的命令时,我会得到错误的消息.

此外,当我执行简单操作时:

var_dump(Hash::make('secret'));

直接在路线中仍然是错误的.

这是坏了还是我错过了什么?

解决方案

您的安装有问题.这就是我得到的:

Route::get('/', function()
{
    var_dump(Hash::make('secret'));  // Gives a bcrypt string output
    var_dump(Hash::check('secret', Hash::make('secret'))); // Output true
}

您是否进行过作曲家更新,而忘记更新应用程序本身?这是目前Laravel 4问题的最常见原因.

此论坛 t提供了有关如何更新主要内容的详细答案作曲家更新后的L4应用.

我将在这里发布论坛内容-因为您需要登录到Laravel论坛才能查看测试版部分:

如果您运行作曲家更新并在此之后遇到问题,那么您最多 可能需要合并应用程序框架中的更改,从而 是laravel/laravel的开发分支.

如果您最初克隆了此存储库,但仍共享git历史记录 有了它,您通常可以轻松地合并更改.假设您的遥控器 指向此存储库的上游",您可以执行以下操作:

git fetch upstream
git merge upstream/develop 

或者,您可以从development分支中挑选单个提交,但在此不做介绍.

如果您最初下载的是zip发行版,或者删除了 上游历史记录,您仍然可以手动解决问题.看着 该分支上的提交并进行不存在于您的任何更改 应用.通常,重大更改是简单的配置 变化.

Laravel 4稳定版发布后,需要执行此操作 频率要低得多,但是这些更改仍然可能发生.记住 在此Beta版应用程序中,发生重大更改的可能性很大 发生.

感谢Kindari提供的论坛帖子.

I'm having auth problems in my new laravel 4 app. The one odd thing I have noticed and this might be why is that when I do:

var_dump(Hash::check('secret', Hash::make('secret')));

in the DB seeder (where I create my hashed passwords) I get true.

When I run that same command directly in a route, I get false.

Also, when I do a simple:

var_dump(Hash::make('secret'));

directly in the route it is still false.

Is this broken or am I missing something ?

解决方案

There is something wrong with your install. This is what I get:

Route::get('/', function()
{
    var_dump(Hash::make('secret'));  // Gives a bcrypt string output
    var_dump(Hash::check('secret', Hash::make('secret'))); // Output true
}

Did you do a composer update, and forget to update the app itself? That is the most common cause of Laravel 4 issues at the moment.

This forum post gives a detailed answer on how to update the main L4 app after a composer update.

Edit: I will post the forum stuff here - because you need to be logged in to Laravel forums to see beta section:

If you run composer update and experience problems after doing so, you most likely need to merge in changes from the application skeleton, which is the develop branch of laravel/laravel.

If you originally cloned this repository and still share a git history with it, you can usually merge in changes easily. Assuming your remote is 'upstream' pointed at this repository, you can do the following:

git fetch upstream
git merge upstream/develop 

Alternatively you could cherry pick in individual commits from the develop branch, but I won't cover that here.

If you downloaded the zip distribution originally or removed the upstream history, you can still resolve your problem manually. Look at the commits on this branch and make any changes not present in your application. Usually the breaking changes are simple configuration changes.

Once Laravel 4 stable has been released the need to do this will be much less frequent, but these changes can still occur. Keep in mind that during this beta application breaking changes are very likely to happen.

Thanks to Kindari for the forum post.

这篇关于Hash :: make无法正常工作route.php文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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