2

I am working on a project with a subscription product. I want to send out a notification (like a log or something) when a certain event is triggered for example the payment has failed. I tried to trigger my log via the EventServiceProvider and via a custom control but it still doesn't trigger my events. Can someone help me? Here is my event

<?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();


    }
}

And here is my controller

<?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');
    }
}
Emma
  • 27,428
  • 11
  • 44
  • 69
tomastecom
  • 21
  • 1
  • 2

1 Answers1

2

check that your VerifyCsrfToken Middleware has

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

so the Webhook can be accessed by Mollie.

shaedrich
  • 5,457
  • 3
  • 26
  • 42