/admin page that you created in Assignment 6, add a button with the text “Email Stats to Users”. This should be a form with a single button that makes a POST request to
/stats. This endpoint should send an HTML email using a Blade template to all users with the following stats:
- Total number of artists
- Total number of playlists
- The sum of
millisecondsfor all tracks displayed in minutes. Round to the nearest minute.
One approach to generating stats is writing aggregate queries.
The emails sent should be queued. It is up to you if you’d like to use a job class or not (
php artisan make:job). You must use a mailable class.
Feel free to style it however you wish. A Bootstrap Card might be a good choice.
php artisan queue:work will run a queue worker, which is a long-lived processes and stores the booted application state in memory. As a result, it will not notice changes in your code base after it has been started. If you make changes to code, simply restart this command. Read Running The Queue Worker from the Laravel documentation for more details.
Unfortunately, the topics we covered this week won’t work on Heroku. Sending a real email involves paying for an email service like Mailgun, which I won’t ask you to do.
Furthermore, we would need a process that keeps
php artisan queue:work running permanently in the background, which I’m almost certain doesn’t work on Heroku with the free plan. Laravel Forge is a service very similar to Heroku but made for Laravel apps and it makes this easy. I highly recommend this if you ever want to deploy a Laravel project. However, this roughly costs $20/month, which I won’t ask you to pay for either.
So, to turn this assignment in, create a short video using Zoom where you demo your application. Be sure to have at least 2 users in your
users table. Send an email to Brighton and me with the URL to your GitHub repository and the link to your Zoom video with the subject: “ITP 405 - Assignment 8”.