Complete the code to dispatch an event named UserRegistered.
event(new [1]());new keyword before the event class.The event() helper dispatches the event instance. Here, UserRegistered is the correct event class to dispatch.
Complete the code to listen for the UserRegistered event in the EventServiceProvider.
'UserRegistered' => [[1]::class],
::class after the listener name.Listeners handle events. SendWelcomeEmail is a typical listener for UserRegistered event.
Fix the error in dispatching the event using the Event facade.
Event::[1](new UserRegistered($user));fire.The correct method to dispatch an event using the Event facade is dispatch.
Fill both blanks to create an event listener class that handles UserRegistered event.
public function handle([1] $event) { [2]; }
The handle method receives the event instance, here UserRegistered. Inside, it calls a method on the user to send a welcome email.
Fill all three blanks to dispatch a queued event with delay.
UserRegistered::[1]()->delay(now()->addMinutes([2]))->[3]();
Use dispatch to queue the event, set delay with delay(), and dispatchAfterResponse to dispatch after HTTP response.