问题标签 [laravel-5.7]

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 投票
6 回答
47461 浏览

php - php获取一个日期还剩多少天和几小时

我保存了一个 created_at 日期,喜欢这个“2011-09-23 19:10:18”,我想知道日期到达之前的日期和时间。我怎么做?和数据库中的列名剩余天数每天自动更新剩余天数,请解决这个问题

0 投票
20 回答
306166 浏览

php - 如何在 Laravel 5+ 中获取客户端 IP 地址

我正在尝试在 Laravel 中获取客户端的 IP 地址。

使用 .php 可以很容易地在 PHP 中获取客户端的 IP $_SERVER["REMOTE_ADDR"]。它在核心 PHP 中运行良好,但是当我在 Laravel 中使用相同的东西时,它返回服务器 IP 而不是访问者的 IP。

0 投票
1 回答
1252 浏览

laravel - 实施自定义 Laravel 护照授予的正确方法是什么?

我一直在修改 laravel 护照,我似乎无法实现自定义授权类型。我正在使用 laravel 5.6 和护照 6.0 。经过研究,我在这个CustomGrant 库中同样创建了一个CustomRequestGrantProvider和一个CustomRequestGrant , 但我没有运气,每次我都会使用grant_type、client_idclient_secret向localhost:8000/oauth/token发出 POST 请求

看起来,我的请求甚至没有通过。我确保将提供程序添加到app.php

这是我的CustomRequestGrantProvider

这是我的CustomRequestGrant

Note: All imports and namespace is correct, i just removed them for the sake of this post.

I even thought about editing the passport library, but i am not sure how sustainable it would be in the future.

Any help is really appreciated.

A few references:

Custom Grants?

Outdated custom grant example

Github discussion

0 投票
3 回答
15511 浏览

laravel - Upgrade Laravel 5.6 to 5.7

I want to upgrade Laravel to 5.7 because I need new features, but I can't find any easy way.

I followed these steps:-Upgrading Laravel Version but I found an error during composer update

I got this error and I also tried to solve the solution but it is not working

My composer.json file:

How do I upgrade Laravel 5.6 to 5.7 with full instructions?

0 投票
0 回答
2859 浏览

php - Laravel 5.7 重定向返回 with() 消息

当用户余额不足时,尝试使用消息重定向到上一页。控制器:

看法:

结果dd($balance, $kitap_baha);是:

$balance- 用户余额 $kitap_baha- 图书价格

它正确返回,但我认为没有会话。

我在这里做错了吗?

0 投票
1 回答
278 浏览

laravel-5.6 - Laravel 5.7.2 中的路由问题

我刚刚下载了 Laravel 5.7.2 项目,发现下面有问题。

下面的行在 Laravel 5.7.2 中不起作用并给出 404

以下适用于 Laravel 5.7.2

下面的代码适用于 Laravel 5.6.16 和 5.6.33

知道为什么相同的代码在 5.7.2 中不起作用吗?

我可以确认该路线存在于路线列表中。

在此处输入图像描述

0 投票
7 回答
27233 浏览

laravel - Laravel 电子邮件验证模板位置

我一直在阅读有关 laravel 电子邮件验证新功能的文档。在哪里可以找到发送给用户的电子邮件模板?它没有在这里显示:https ://laravel.com/docs/5.7/verification#after-verifying-emails

0 投票
1 回答
37 浏览

php - 如何在 Laravel 中渴望​​加载 3 种不同的关系?

我有 4 个表:useruser_courseclassesqueues

user_courseuser_id,classesuser_course_id,queuesclasses_id列。

我想检索与当前注册的aclass_id相对应的所有队列。user_courseuser_id

基本上,我想做的是:$user->user_course->classes->queues

除了我不能直接循环上面的内容。

那么我怎么能急切地加载它,$classes = App\Classes::with('Queues')除了将它限制到当前登录之外user_id呢?

我是渴望加载的新手,无法让它工作。如果我需要编辑我的问题详细信息,请通知我。

0 投票
1 回答
1613 浏览

ajax - 为 Ajax 调用使用 Passport:Laravel

Passport在我Laravel-5.7的基于应用程序中使用。这是我第一次Laravel使用Passport. 我能够oauth_access_token成功生成。但是,Passport在我的应用程序中集成会中断正在运行的 ajax 调用。我试图在互联网上找到解决方案,但我错过了一些观点。

每当我发出 ajax 请求时,我都会得到这个结果{"message":"Unauthenticated."}

由于该路由应该在管理面板中使用,因此它使用受保护的路由。这是我的 ajax 调用的 Javascript 代码:

API 路由声明:

Route::post('functionCall', ['middleware' => 'auth:api', 'uses' => 'XYZ@functionCall', 'as' => 'xyz']);

请帮我理清这段代码中缺少的内容。

0 投票
1 回答
918 浏览

arrays - 如何在 Laravel 中遍历包含数组的集合数组?

我的集合是使用以下查询实例化的:$ClassesCollection = Classes::with('Queue')->whereIn('user_course_id', UserCourse::select('id')->where('user_id', $user->id))->get();

$ClassesCollection 返回所需的结果。但是,我只想要Queue结果。

所以我这样拆分

现在我有一个集合数组,每个集合都包含Queues 数组。

如何遍历这些集合以Queue在我的视图中分别显示每个 s 数组的内容?

这就是$classes成立

每个Queue都有几个属性,例如dateclass_id。那么如何才能显示每个Queue的内容呢?

编辑:我认为会有一种更清洁的方法,但这就是我为遇到此问题的任何人解决问题的方法。

注释掉的代码也达到了预期的效果。