问题标签 [laravel-6]

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 投票
2 回答
229 浏览

laravel - 使用 Laravel 包是否比手动实现它们更有效?

我想知道在 Laravel 中使用库而不是手动编写代码是否是一种有效的实现方式?

示例:如果我使用的是 SweetAlert 或 CKEditor 之类的包?

在手动过程中,我们通常会做三件事:

  • 包括 CSS
  • 包含 JS
  • 调用JS

但是,如果我们使用包来安装,它会遵循整个 Laravel 框架的生命周期

如果使用需要大量配置的大型或庞大的库,例如azure saml-2、PayPal或任何其他支付集成。我总是更喜欢使用手动实现较少且覆盖方法较多的包。

对于我的下一个项目,我做同样的事情。请向我推荐什么是最好的做事方式。我只关心优化的代码。我愿意花更多的时间编写代码,而不是为每件小事安装库。

0 投票
0 回答
526 浏览

vue.js - 如何使用不记名令牌通过 api 流式传输视频下载?- Laravel、Vue.js、HTML5

我正在按照本指南返回视频下载响应:https ://laravel.com/docs/5.8/responses#file-downloads

我想通过 API 调用来做到这一点,其中用户是通过不记名令牌来识别的。

ajax 调用应该是什么样子,所以我在将它“注入”到 HTML5 视频 src 的同时得到这个响应?

我已经尝试过以下

控制器

Javascript

但我在控制台中收到以下错误

0 投票
0 回答
264 浏览

jquery - 在推送器上接收事件但数据的值为空

我有一个问题 Pusher(我正在接收广播的事件,但是在我正确传递后数据的值为 null)。

我正在使用 Pusher 将事件分派到我的应用程序。我将事件从应用程序发送到推送器(连同我的数据)。我正在发送一条短信,只是一个简单的字符串。在 Pusher 调试控制台上,我收到了事件,但我的数据值为 null。我已经关注了很多关于如何配置我的 laravel 环境的视频,但是我的数据的值仍然是空的。

我是 Pusher 和 Laravel 的初学者。我正在尝试使用 Laravel Pusher 和 jQuery 开发一个实时聊天应用程序。我看过很多关于它的视频教程并对其进行了大量搜索,但仍然找不到解决问题的方法。

事件类

在此处输入图像描述

0 投票
1 回答
65 浏览

php - Laravel Eloquent casted array field pull results that have some of the submitted ids

I have a table called recipes that has a field cast to an array that houses ids from another table ingredients. A user can select from a form, specific ingredients they want to see recipes for.

Is there a way I can take the submitted list of ids and only pull recipes that have some of those ids? I say some because I don't want to limit to recipes that have only ALL of the ids. Meaning if someone chooses chicken, onions, and celery and there are recipes that contain those ingredients plus carrots, peppers and mushrooms I want to show those as well.

The only query I can come up with seems to compare exact to exact.

With ingredient_ids being the list of submitted ingredients.

0 投票
1 回答
10531 浏览

php - Laravel 6: Class 'Form' not found

I have a fresh Laravel 6 and I try to use Laravel forms but I got the error saying "Class 'Form' not found ".

I tried the followings but still not working:

1). Add this to composer.json

2). update composer from the Terminal:

3). add this to the providers of config/app.php:

4). Finally, add two class aliases to the aliases array of config/app.php:

Please give advice because it works only with Laravel 5.8.

0 投票
1 回答
2300 浏览

session - Laravel 6.0 写入会话时出错 ias 无法在 Windows 中打开文件流

我在 Laravel 6.0.0 中做一个项目。我正面临下面给出的错误。

file_put_contents(C:\xampp\htdocs\lsapp\storage\framework/sessions/):无法打开流:没有这样的文件或目录。

已经从 bootstrap/cache/config.php 中删除了 config.php 文件。但它不起作用。有什么解决方法吗?

0 投票
1 回答
3344 浏览

laravel - 无法在 Laravel 6.0 中使用 Composer 安装软件包

我已经建立了一个新的 Laravel 6 项目并正在尝试安装一些软件包。到目前为止,我已经下载了核心包、Laravel Passport 和 Spatie 的角色系统。

现在,我正在尝试下载这个模型生成器。

https://github.com/krlove/eloquent-model-generator

然而,它没有奏效。我只得到以下输出:

我想:好吧,也许是包裹。所以我尝试了另一个包,它做同样的事情,也没有为我工作。

所以现在我不知道这是作曲家还是 laravel 6 的问题。我不需要这个包,因为它只生成模型。但是如果我想稍后安装我需要的软件包,如果我收到这个错误,那就太愚蠢了。

有解决办法吗?我没有找到太多关于这个错误的信息。

0 投票
1 回答
123 浏览

laravel - 在 Laravel 6.0 中为路由中间件使用多个参数

在我的 Laravel 6.0 应用程序中,我需要使用带有两个参数的路由。

我也试过:

在我的政策中,我有:

但是,它不起作用,并且永远不会调用该策略。如何在路由中间件中传递两个参数?

0 投票
8 回答
39601 浏览

laravel - 在 laravel 6.0 中未定义命令“ui”

我在 laravel 中开始了一个新项目,但我的作曲家安装了新版本的 laravel 6.0.1。

Php artisan make:auth命令不起作用。

我尝试了很多次但错误无法删除

已安装,但是当我使用第二个命令时:

然后系统向我显示此消息:

0 投票
1 回答
11214 浏览

node.js - 'npm' 在 laravel 6.0 中不被识别为内部或外部命令、可运行程序或批处理文件

在我的 laravel 项目中,我会尝试npm install. 但它在我的 cmd 中无法识别。我尝试编辑环境变量并添加C:\Program Files\nodejs\但仍然无效。我要怎么做才能让 npm 运行?这将是我第一次使用 npm。