<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Http\Controllers\TransactionController;

class CheckAndUpdatePaymentsCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'payments:check';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Check and update pending payments';

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
          // Instantiate the controller
          $controller = new TransactionController(); // Replace with the actual controller name

          // Call the checkAndUpdatePayments method
          $controller->checkAndUpdatePayments();
  
          // Optionally, output a message to the console
          $this->info('Checked and updated payments.');

        return Command::SUCCESS;
    }
}
