问题标签 [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.
php - php获取一个日期还剩多少天和几小时
我保存了一个 created_at 日期,喜欢这个“2011-09-23 19:10:18”,我想知道日期到达之前的日期和时间。我怎么做?和数据库中的列名剩余天数每天自动更新剩余天数,请解决这个问题
php - 如何在 Laravel 5+ 中获取客户端 IP 地址
我正在尝试在 Laravel 中获取客户端的 IP 地址。
使用 .php 可以很容易地在 PHP 中获取客户端的 IP $_SERVER["REMOTE_ADDR"]
。它在核心 PHP 中运行良好,但是当我在 Laravel 中使用相同的东西时,它返回服务器 IP 而不是访问者的 IP。
laravel - 实施自定义 Laravel 护照授予的正确方法是什么?
我一直在修改 laravel 护照,我似乎无法实现自定义授权类型。我正在使用 laravel 5.6 和护照 6.0 。经过研究,我在这个CustomGrant 库中同样创建了一个CustomRequestGrantProvider和一个CustomRequestGrant , 但我没有运气,每次我都会使用grant_type、client_id和client_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:
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?
php - Laravel 5.7 重定向返回 with() 消息
当用户余额不足时,尝试使用消息重定向到上一页。控制器:
看法:
结果dd($balance, $kitap_baha);
是:
$balance
- 用户余额
$kitap_baha
- 图书价格
它正确返回,但我认为没有会话。
我在这里做错了吗?
laravel - Laravel 电子邮件验证模板位置
我一直在阅读有关 laravel 电子邮件验证新功能的文档。在哪里可以找到发送给用户的电子邮件模板?它没有在这里显示:https ://laravel.com/docs/5.7/verification#after-verifying-emails
php - 如何在 Laravel 中渴望加载 3 种不同的关系?
我有 4 个表:user
、user_course
、classes
和queues
。
user_course
有user_id
,classes
有user_course_id
,queues
有classes_id
列。
我想检索与当前注册的aclass_id
相对应的所有队列。user_course
user_id
基本上,我想做的是:$user->user_course->classes->queues
除了我不能直接循环上面的内容。
那么我怎么能急切地加载它,$classes = App\Classes::with('Queues')
除了将它限制到当前登录之外user_id
呢?
我是渴望加载的新手,无法让它工作。如果我需要编辑我的问题详细信息,请通知我。
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']);
请帮我理清这段代码中缺少的内容。
arrays - 如何在 Laravel 中遍历包含数组的集合数组?
我的集合是使用以下查询实例化的:$ClassesCollection = Classes::with('Queue')->whereIn('user_course_id', UserCourse::select('id')->where('user_id', $user->id))->get();
$ClassesCollection 返回所需的结果。但是,我只想要Queue
结果。
所以我这样拆分
现在我有一个集合数组,每个集合都包含Queue
s 数组。
如何遍历这些集合以Queue
在我的视图中分别显示每个 s 数组的内容?
这就是$classes
成立
每个Queue
都有几个属性,例如date
和class_id
。那么如何才能显示每个Queue的内容呢?
编辑:我认为会有一种更清洁的方法,但这就是我为遇到此问题的任何人解决问题的方法。
注释掉的代码也达到了预期的效果。