如何解决Laravel Cashier Mollie事件侦听器未触发事件
我正在开发一个带有订阅产品的项目。我想在触发某个事件(例如付款失败)时发出通知(例如日志或其他内容)。我试图通过EventServiceProvider
和自定义控件来触发日志,但是它仍然不会触发我的事件。有人能帮我吗?这是我的活动
<?PHP
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Log;
use Laravel\Cashier\Events\OrderPaymentPaid;
use App\Listeners\OrderPaymentsPaidListener;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
OrderPaymentPaid::class => [
// Your custom listener
OrderPaymentsPaidListener::class,],];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
parent::boot();
}
}
这是我的控制器
<?PHP
namespace App\Listeners;
use App\Events\Laravel\Cashier\Events\OrderPaymentPaid;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Log;
class OrderPaymentsPaidListener
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param OrderPaymentPaid $event
* @return void
*/
public function handle(OrderPaymentPaid $event)
{
Log::error('test');
}
}
解决方法
检查您的 VerifyCsrfToken 中间件是否具有
protected $except = [
'webhooks/mollie',];
因此 Mollie 可以访问 Webhook。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。