我正在使用 laravel 帆在 swoole 上运行 laravel 辛烷值。
我对 EventServiceProvider 进行了更改:
<?php
namespace App\Providers;
use App\Events\SubscriptionCreated;
use App\Listeners\CreateUserTeam;
use App\Listeners\SendSubscriptionReceipt;
use App\Listeners\UpdateTeamFeatures;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
CreateUserTeam::class
],
SubscriptionCreated::class => [
SendSubscriptionReceipt::class,
UpdateTeamFeatures::class
]
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
\Log::debug("HERE", $this->listen);
}
}
这是我的听众:
<?php
namespace App\Listeners;
use App\Models\Team;
use Illuminate\Auth\Events\Registered;
class CreateUserTeam
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
\Log::debug("HIT");
}
/**
* Handle the event.
*
* @param Registered $event
* @return void
*/
public function handle(Registered $event)
{
$user = $event->user;
$team = Team::create([
'manager_id' => $user->id,
]);
$team->createAsStripeCustomer();
$user->update(['team_id' => $team->id]);
}
}
无论我尝试什么,这个事件监听器都不会被解雇。我试过清除缓存、composer dump-autoload、php artisan optimize、重新加载辛烷值、停止辛烷值并重新启动它。甚至停止 docker 容器并重新启动它们。没有任何效果。
它记录侦听器列表(包括 CreateUserTeam 侦听器),它会触发电子邮件通知,但不会触发其他侦听器。
如果有人有任何见解......请。我束手无策