Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

JhumanJ/OpnForm

3005 stars
3 code files
View JhumanJ/OpnForm on GitHub

app/Providers/EventServiceProvider.php

Open in GitHub
use 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 GitHub
use 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 GitHub
use 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));
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.