recreate project
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use CodeIgniter\CLI\BaseCommand;
|
||||
use CodeIgniter\CLI\CLI;
|
||||
use App\Models\UserModel;
|
||||
use App\Services\NotificationService;
|
||||
|
||||
class CheckMissedPayments extends BaseCommand
|
||||
{
|
||||
protected $group = 'Payments';
|
||||
protected $name = 'payments:check-missed';
|
||||
protected $description = 'Checks for users who missed payments and sends reminders.';
|
||||
|
||||
public function run(array $params)
|
||||
{
|
||||
$userModel = new UserModel();
|
||||
|
||||
// Fetch users who missed payment (you need to implement this query)
|
||||
$missedUsers = $userModel->getUsersWithMissedPayments();
|
||||
|
||||
foreach ($missedUsers as $user) {
|
||||
NotificationService::toUser(
|
||||
$user['id'],
|
||||
'Payment Missed',
|
||||
'You have a missed payment. Please pay to avoid penalty.',
|
||||
['in_app', 'email', 'sms']
|
||||
);
|
||||
CLI::write("Reminder sent to {$user['email']}", 'yellow');
|
||||
}
|
||||
|
||||
CLI::write("Finished checking missed payments.", 'green');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user