Creating scheduler to notify users of new comics
Now is the time for another superpower feature built into Laravel—scheduling! OK, it does not sound that exciting, but the fact that I can set one cron job on my server to do all my tasks makes it a lot easier to move my features from server to server. I will show here one example of how to use it based on the console command that I made previously.
Getting ready
A base install of Laravel is fine. If you follow the preceding recipe, you will have a decent size command to run via this scheduling example.
How to do it…
In the previous recipe, we ran
php artisan make:console GetUsersLatestsFavoritesConsole
to get a console command. Then, I added some query work over there to make it do its thing.I then updated the code in
app/Console/Commands/GetUsersLatestsFavoritesConsole.php
to catch any issues and put them in the logs. This way, I can see when things go wrong, since I will not be running this at the command line. I will talk about this more in...