小编Eri*_*rik的帖子

laravel 5中的登录事件处理

我试图挂钩登录甚至在我的L5应用程序中设置上次登录时间和IP地址.我可以使用以下内容:

Event::listen('auth.login', function($event)
{
    Auth::user()->last_login = new DateTime;
    Auth::user()->last_login_ip = Request::getClientIp();
    Auth::user()->save();
});
Run Code Online (Sandbox Code Playgroud)

但是,我想知道在L5中执行此操作的最佳方法是使用事件处理程序对象.我尝试创建一个事件处理程序并在事件服务提供程序中添加auth.login作为数组键,但是这不起作用.我不确定auth.login事件是否可行.如果不是,那么放置上述代码的最合适的位置.为了测试,我把它放在我的routes.php文件中,但我知道它不应该在哪里.

php laravel laravel-5

12
推荐指数
5
解决办法
2万
查看次数

vue.js - 未捕获的TypeError:无法读取null的属性'$ forContext'

我遇到了一个非常奇怪的问题.一切似乎都正常工作,但提交输入(我在使用<form/>元素和keyop.enter事件时尝试了表单提交事件,我在JS控制台中得到以下错误,无法弄明白.

控制台错误如下:

Uncaught TypeError: Cannot read property '$forContext' of null
Watcher.set @ bundle.js:12831
(anonymous function) @ bundle.js:17611
Directive._withLock @ bundle.js:17628
Directive.set @ bundle.js:17610
listener.rawListener @ bundle.js:13664
n.event.dispatch @ jquery.js:4435
r.handle @ jquery.js:4121
remove @ bundle.js:10835
(anonymous function) @ bundle.js:10687applyTransition @ bundle.js:10715
removeWithTransition @ bundle.js:10686
singleRemove @ bundle.js:14172
remove @ bundle.js:14374
update @ bundle.js:14359
_update @ bundle.js:17482
Watcher.run @ bundle.js:12933
runBatcherQueue @ bundle.js:12666
flushBatcherQueue @ bundle.js:12642
nextTickHandler @ bundle.js:10079
Run Code Online (Sandbox Code Playgroud)

我的组件代码:

module.exports = {
    data: function () {
        return { …
Run Code Online (Sandbox Code Playgroud)

vue.js

4
推荐指数
1
解决办法
4010
查看次数

标签 统计

laravel ×1

laravel-5 ×1

php ×1

vue.js ×1