Support the ongoing development of Laravel.io →
posted 8 years ago
Queues
Last updated 7 months ago.
0

Change Route::get('/email') to Route::get('email')

Last updated 7 months ago.
0
Solution

Try wrapping your $data into an array:

$dd = Event::fire('email.send', array($data));
Last updated 7 months ago.
0

rags02 said:

Try wrapping your $data into an array:

$dd = Event::fire('email.send', array($data));

Please, could you provide and explaination to this behaviour? We could not figure it out on #laravel

Last updated 7 months ago.
0

Because the listener fires call_user_func_array() which needs an array for the arguments. In the OP code each array value would be seen as a separate argument rather than one arg for the listener (which was expected by the dd() call).

Last updated 7 months ago.
0

Thanks rags02, makes sense now.

Last updated 7 months ago.
0

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

veksen veksen Joined 28 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.