-
app/Providers/EventServiceProvider.php
Open in GitHubuse App\Events\Models\FormCreated; use App\Notifications\Forms\FormCreatedNotification; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; class EventServiceProvider extends ServiceProvider { protected $listen = [ // FormCreated::class => [ FormCreationConfirmation::class ], // ]; // }
-
app/Events/Models/FormCreated.php
Open in GitHubuse App\Models\Forms\Form; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; class FormCreated { use Dispatchable, InteractsWithSockets, SerializesModels; public function __construct(public Form $form) {} }
-
app/Listeners/Forms/FormCreationConfirmation.php
Open in GitHubuse App\Events\Models\FormCreated; use App\Mail\Forms\FormCreationConfirmationMail; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Support\Facades\Mail; class FormCreationConfirmation implements ShouldQueue { public function handle(FormCreated $event) { Mail::to($event->form->creator)->send(new FormCreationConfirmationMail($event->form)); } }