Followed the above exactly to send an API call to email list app, and with Spark I'm getting an error message after the User tries to register (contact provider, the red modal that pops up).
Funny thing is, if I drop the event into a controller it works great:
$user = $event->user;
$api_key = '<secret>';
$client = new Client();
$url = "https://api.emailprovider.com/subscribe";
$data = ['email' => $user->email, 'name' => $user->name, 'api_key' => $api_key];
$response = $client->post($url, ['query' => $data]);
This works great in a controller, but as part of an event listener it's giving me that error in the Register window - with no extra info to try and figure out why.
I have HookRegisteredUser in App\Listeners that looks like the above with this wrapping it:
public function handle(UserRegistered $event)
{
and then in my App\Providers\EventServiceProviders.php I have this:
'Laravel\Spark\Events\Auth\UserRegistered' => [
'Laravel\Spark\Listeners\Subscription\CreateTrialEndingNotification',
'App\Listeners\HookRegisteredUser',
],
Any ideas where the Error is coming from - in the Console I'm just seeing 500.