身份验证.在Laravel中注册事件


auth.register Event in Laravel

我目前正在尝试添加事件,当一个用户在Laravel 5.1注册。我已经成功地添加了2个工作完美的事件处理程序,但是当我使用

构建另一个事件时:

php artisan handler:event UserVotesAfterRegister

这个根本不会被调用。我在Laravel网站上读到,你可以有尽可能多的事件处理程序,所以我真的不知道为什么这个没有被解雇。

这是我的监听事件存储在EventServiceProvider:

protected $listen = [
    'App'Events'SomeEvent' => [
        'App'Listeners'EventListener',
    ],
    'SocialiteProviders'Manager'SocialiteWasCalled' => [
        // add your listeners (aka providers) here
        'SocialiteProviders'Tumblr'TumblrExtendSocialite@handle'
    ],
    'auth.login' => [
        'App'Handlers'Events'UserVotesAfterLogin',
        'App'Handlers'Events'AddInteractionLog',
        'App'Handlers'Events'PageInteractionTracking',
    ],
    'auth.register' => [
        'App'Handlers'Events'UserVotesAfterRegister',
        'App'Handlers'Events'AddInteractionLog',
        'App'Handlers'Events'PageInteractionTracking',
    ],
    'auth.password' => [
        'App'Handlers'Events'AddInteractionLog',
        'App'Handlers'Events'PageInteractionTracking',
    ],
    'auth.logout' => [
        'App'Handlers'Events'AddInteractionLog',
    ],
];

下面是我的事件处理程序,它是由artisan make命令构建的:

namespace App'Handlers'Events;
use Illuminate'Queue'InteractsWithQueue;
use Illuminate'Contracts'Queue'ShouldQueue;
use App'User;
class UserVotesAfterRegister
{
    /**
     * Create the event handler.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }
    /**
     * Handle the event.
     *
     * @param  Events  $event
     * @return void
     */
    public function handle()
    {
        //
        dd("DIE");
    }
}

如有任何帮助,不胜感激。

我已尝试使用:

清除所有缓存

dumpautoload作曲家作曲家dump-autoloadPHP工匠清楚编译PHP工匠优化

…但无济于事

namespace App'Handlers'Events;
use Illuminate'Queue'InteractsWithQueue;
use Illuminate'Contracts'Queue'ShouldQueue;
use App'User;
class UserVotesAfterRegister
{
/**
 * Create the event handler.
 *
 * @return void
 */
public function __construct()
{
    //
}
/**
 * Handle the event.
 *
 * @param  Events  $event
 * @return void
 */
public function handle(SomeEventHandler $event)
{
    // The $event is missing here. Please consider it first and try again.
    dd("DIE");
}
}

右,

我想我已经弄明白了。基本上,这是不真实的。注册事件。当您注册一个新用户时,授权。在注册和登录时调用Login事件。

网站上写着:

当尝试方法被调用时,auth。尝试事件将被触发。如果验证尝试成功,用户登录成功,则验证成功。登录事件也将被触发。

这表示即使用户注册了auth。