1

我正在开发一个带有订阅产品的项目。我想在触发某个事件(例如付款失败)时发送通知(如日志或其他内容)。我试图通过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');
    }
}
4

1 回答 1

2

检查您的 VerifyCsrfToken 中间件是否有

protected $except = [
   'webhooks/mollie',
];

因此,Mollie 可以访问 Webhook。

于 2021-03-31T13:59:39.933 回答