hello guys
i want to prepare an email to be sent after 50 days when the user click on a button then go to controller
i found "later" method but i did not work, its sends the email immediately.
also i found "scheduler" but i could not understand how to work with it because its about every day , monthly, yearly,...
what i want is after specific date only
may laravel is 5.2
The scheduler fires when ever you need it. Probably in your case every day. Then the scheduler fires a command. In the command you can query and get any users That clicked the button 50 days or more where you haven't sent an email yet (assuming you store that data somewhere). After email successfully sent, mark the data row (update Boolean value) so you don't send again.
Scheduler is based off a single cron job. A nice wrapper to schedule tasks.
@jekinney's suggestion makes a lot more sense than shoving it into a queue to wait 50 days. Store the necessary information in the database, and check that table daily for any items that are now 50 days old, and process them, at which point you could either remove them or mark them as processed with a date stamp/etc.
Using a redis or similar queue, for this particular use case seems entirely wrong to me.
@sandstorm as @jekinney suggested, yes I think that makes the most sense in your case given the length of the delay you're looking for before taking action.
@sandstorm As suggested by @jekinney, the best approach (and the one that immediately sprung to mind to me) was to set up a scheduler task that runs every day and each day it runs, you check for users who “clicked a button” 50 days ago and send them the email.
php /path/to/artisan the path to artisan is the path to the directory your application is in... so it might be something like php /var/www/myapp/artisan
@vmitchell85
i change it this way
C:>* * * * * php /xampp/htdocs/training-portal/artisan schedule:run >> /dev/null 2>&1
The system cannot find the path specified.
as you see still have problem
is it correct path?
my actual path is
C:\xampp\htdocs\training-portal