订户中的事件未触发
Event in subscriber not firing
我似乎无法弄清楚为什么事件没有触发。
在ProviderEvenServiceProvider
protected $subscribe = [
'App\Listeners\ProductEventSubscriber',
];
在Listeners\ProductEventSubscriber
use Spatie\MediaLibrary\MediaCollections\Events\ConversionHasBeenCompleted;
public function mediaConversionHasBeenCompleted($event)
{
Log::info('Hi');
}
public function subscribe($events)
{
return [
ConversionHasBeenCompleted::class => [
[ProductEventSubscriber::class, 'mediaConversionHasBeenCompleted'],
],
];
}
我已经 运行 php artisan optimize:clear
并重新启动 horizon。我可以看到正在处理并成功完成的事件。但是 mediaConversionHasBeenCompleted
方法不会被触发。我可能缺少什么?
好的,所以我使用了 ConversionHasBeenCompleted
事件,而我不得不使用 ResponsiveImagesGenerated
,因为我使用的是响应式图像选项。此事件未记录在案,因此我将联系 Spatie 团队。
我似乎无法弄清楚为什么事件没有触发。
在ProviderEvenServiceProvider
protected $subscribe = [
'App\Listeners\ProductEventSubscriber',
];
在Listeners\ProductEventSubscriber
use Spatie\MediaLibrary\MediaCollections\Events\ConversionHasBeenCompleted;
public function mediaConversionHasBeenCompleted($event)
{
Log::info('Hi');
}
public function subscribe($events)
{
return [
ConversionHasBeenCompleted::class => [
[ProductEventSubscriber::class, 'mediaConversionHasBeenCompleted'],
],
];
}
我已经 运行 php artisan optimize:clear
并重新启动 horizon。我可以看到正在处理并成功完成的事件。但是 mediaConversionHasBeenCompleted
方法不会被触发。我可能缺少什么?
好的,所以我使用了 ConversionHasBeenCompleted
事件,而我不得不使用 ResponsiveImagesGenerated
,因为我使用的是响应式图像选项。此事件未记录在案,因此我将联系 Spatie 团队。