This system automatically sends email notifications to all approvers twice daily at 9:00 AM and 4:00 PM (Africa/Addis_Ababa timezone) with a summary of their pending approvals.
app/Jobs/SendDailyPendingApprovalsNotificationJob.php- Handles both division-specific and regular approvers
- Only sends emails to approvers with pending items
- Creates notification records in database
- Uses PHPMailer for email delivery
- Includes retry mechanism (3 attempts)
- 5-minute timeout for bulk operations
app/Console/Commands/SendDailyPendingApprovalsCommand.phpphp artisan notifications:daily-pending-approvals - --test: Run in test mode (dry run, no emails sent)
- --force: Force run even if not scheduled time
resources/views/emails/daily-pending-approvals-notification.blade.php- Responsive HTML design
- Summary statistics
- Categorized pending items
- Direct links to view items
- Professional styling
routes/console.php- Without overlapping protection
- Background execution
- Automatic timezone handling
- Dynamic subject lines (Morning/Evening)
- Dynamic greetings in email content
Ensure your queue is properly configured in .env:
QUEUE_CONNECTION=database
# or
QUEUE_CONNECTION=redis
Verify email settings in .env:
MAIL_MAILER=smtp
MAIL_HOST=your-smtp-host
MAIL_PORT=587
MAIL_USERNAME=your-email
MAIL_PASSWORD=your-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@africacdc.org
MAIL_FROM_NAME="Africa CDC APM"
MAIL_SUBJECT_PREFIX="Approval Management System"
Run the queue table migration if using database queue:
php artisan queue:table
php artisan migrate
The schedule is already configured. To verify:
php artisan schedule:list
For production, set up queue workers:
# Start queue worker
php artisan queue:work --daemon
# Or use supervisor for production
php artisan notifications:daily-pending-approvals --test
php artisan notifications:daily-pending-approvals --force
php artisan schedule:run
Monitor the application logs:
tail -f storage/logs/laravel.log
Check queue status:
php artisan queue:work --once
- Fix: chmod -R 775 storage/logs
- Fix: chown -R www-data:www-data storage/logs
- Check: php artisan queue:work
- Verify: Queue configuration in .env
- Check: SMTP configuration
- Verify: Email credentials
- Test: php artisan tinker and send test email
- Check: Cron job setup
- Verify: php artisan schedule:list
- Test: php artisan schedule:run
- Consider: Processing in batches
- Implement: Memory clearing between batches
- Consider: Using Redis queue
- Implement: Multiple queue workers
- Implement: Rate limiting
- Consider: Staggered sending
- No sensitive data in emails
- Only summary information
- Links require authentication
- Only approvers receive notifications
- Based on actual approval levels
- Respects division boundaries
- Minimal data in email content
- Secure links to full details
- No personal information exposure
For issues or questions:
--test flagLast Updated: September 14, 2025
Version: 1.0
Status: Production Ready