mardi 24 septembre 2019

How to get payload in event laravel?

In my controller I have this code.

event(new ExampleEvent(), ['data' => '123']);

the event helper has payload arguments. I'm trying to study If i get the data value using payload. In my listener

class ExampleListener implements ShouldQueue
{
    use InteractsWithQueue;

    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  ExampleEvent  $event
     * @return void
     */
    public function handle(ExampleEvent $event)
    {
         // dd($this->payload);
    }
}

I want to get the data value in my payload as what I add it to my controller. I'm searching it in google on how to get the payload but failed to learn it.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire