问题标签 [laravel-5.4]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
4 回答
8277 浏览

php - 解密 Laravel 密码重置令牌

我正在编写一个测试,以确保我的应用程序的密码重置功能有效。密码重置系统是使用该php artisan make:auth命令创建的。为了使测试通过,我需要将 GET 请求自动化到表中存储的值在/password/reset/{$token}哪里。Laravel 像这样存储令牌:$tokenpassword_resets

$2y$10$9grKb3c6.Toiv0kjUWbCUeT8Q8D.Fg2gZ/xDLGQUAkmdyHigmRkNW

但是当 Laravel 向用户发送密码重置邮件时,重置令牌在邮件中如下所示:

382aa64567ecd05a774c2e4ebb199d3340a1424300707053354c749c10487594.

/password/reset/$2y$10$9grKb3c6.Toiv0kjUWbCUeT8Q8D.Fg2gZ/xDLGQUAkmdyHigmRkNW由于重置令牌中的正斜杠,我的 GET 请求失败。(就在“g2gZ”之后

我尝试使用辅助功能decrypt(),但没有运气。

如何转换从password_resets表中提取的密码重置令牌以匹配 Laravel 发送给用户的内容?

不确定这是否相关,但我确实将我的应用程序从 5.3 升级到了 5.4。

0 投票
1 回答
571 浏览

php - Laravel 正确迁移表,但无法通过 Eloquent 与 DB 对话

所以我有一个几乎是基本的 Laravel 5.4 应用程序。我跑去php artisan make:auth搭建身份验证系统。我能够迁移用户表没问题

但是,当我尝试注册时,会引发 SQL 无法连接错误

如果我能够成功迁移表,怎么会发生这种情况?即使在注册方法引发该错误之后,我仍然能够回滚迁移:

并重新迁移表:

所以我知道 PostgreSQL 服务器已启动并正在运行。

小更新 Laravel 5.3 也发生了同样的问题,因此它与最近发布的 5.4 无关

0 投票
4 回答
45335 浏览

laravel - `npm run watch` 在 Laravel 5.4 中不起作用

使用 Laravel 5.4 和 Mix,当我运行npm run watch它时,它会编译所有内容,看起来它正在等待更改,但是当我对我的任何资产文件进行更改时,它似乎没有检测到任何东西。还有其他人在 5.4 中遇到此问题或有解决方案吗?

0 投票
7 回答
27961 浏览

laravel - PHPunit 未捕获错误:调用未定义的方法 PHPUnit_Util_Configuration::getTestdoxGroupConfiguration()

我不知道它是否与 Laravel 5.4 有关。当我phpunit在安装 laravel 5.4 后运行命令而不做任何更改时,我得到Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration()但是当我运行它时php artisan dusk它运行正常

任何想法如何解决这一问题?

0 投票
1 回答
1372 浏览

php - Laravel 5.3 到 5.4 (mPdf - niklasravnsborg/laravel-pdf ) 升级问题

Laravel 5.3 到 5.4 (mPdf - niklasravnsborg/laravel-pdf) 升级问题

0 投票
1 回答
176 浏览

javascript - Update options select attributes according to the other select tag with the help of Ajax and Laravel?

I have the select tag and a series of options select attributes with their values and inner text stored in the database.

This is the way I am displaying the data on view, by calling a foreach for each select tag, 2 in total:

The problem, is that I am stuck with the following idea: The category and the subcategory are in one to many relationship, that means that when the user clicks a certain category, the select subcategory should be populated only with the values linked to the category chosen.

How can I find a solution to this problem, I am thinking about creating an ajax request but I can't figure how to populate the option select attributes. Or create a JSON (all the work on front-end) variable to store the subcategories and just update the select tag accordingly to what category user chose.

Any help will be greatly appreciated.

SOLUTION:

VIEW:

JS & JQUERY & AJAX:

ROUTE:

CONTROLLER:

Don't forget to introduce in the controller the corresponding models, facades for Input and Response. In my case:

0 投票
2 回答
871 浏览

php - 升级到 Laravel 5.4 - 一些路由现在失败了?

我有一个完全可以工作的项目Laravel 5.3,昨天我升级到Laravel 5.4本地以检查所有工作是否正常,并且非常高兴,因此制定了一个计划来将其迁移。

我现在已经在我的forge.laravel.com托管服务器上部署了站点,大多数路由都可以正常工作,但是在尝试注销时出现以下错误:

在此处输入图像描述

我不太确定问题到底是什么。该站点在本地运行良好。谁能指出我正确的方向?

0 投票
3 回答
2986 浏览

php - 如何在 laravel 5.4 中断言列表中的每条记录至少具有登记属性?

我只是将应用程序从 laravel 5.3 移动到 5.4。在我的 API 测试中的 laravel 5.3 中,我可以验证响应中的每条记录都具有以下代码的属性:

我如何使用 laravel 5.4 做同样的事情?

Illuminate/Foundation/Testing/TestResponse中没有这样的方法

0 投票
1 回答
4530 浏览

php - 在 L5.4 中验证时忽略空字段的 FormRequest 方法

我有一个带有此规则的表单请求:

此解决方案在 L5.3 中运行良好,因为规则本身存在错误,如果您传递两个空字段,例如

它们将被验证,因为它们都是空字符串 ( "")。即使这是一个错误,我想,这在一定程度上是可以的,因为我的应用程序在请求之后会进行其他检查,但是在 L5.4 中,每个空字段都被转换为null,并且"confirmed"由于新的中间件,单独的规则不再起作用.

我试过了:

但它不起作用,因为密钥存在。

我的问题很简单:

是否有类似于sometimes但它检查可空值的验证规则?

我想保留中间件。

0 投票
2 回答
155 浏览

php - 在 Laravel 5.4 上安装 cartalyst/tags 时出错

我想在 laravel 5.4 上安装cartalyst/tagscomposer install但在/之后出现了一些错误composer update

这里的错误: