Is it possible to Fire Event or listener after certain time in Laravel, my idea is to have one listener for sending mails after one minute, after user registration, cron isnt solution for this case.
In this case a job would be a better options. To be honest queued jobs when firing logic within your application is more suited for this kind of logic.
Jobs require less set up to events as you only need a single class, rather than events and listeners.
To delay your job use the following syntax, where SendReminderEmail is your job. The parameter in the delay function is the number of seconds you wish to delay the process.
$job = (new SendReminderEmail($user))->delay(60);
https://laravel.com/docs/5.1/queues#delayed-jobs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With