<?php

namespace App\Models;

use CodeIgniter\Model;

class TransactionModel extends Model
{
    protected $table      = 'transactions';
    protected $primaryKey = 'transaction_id';
    protected $allowedFields = ['id', 'transaction_id', 'reference', 'msisdn', 'amount', 'status', 'created_at'];
    protected $useTimestamps = false;

    // Fetch all transactions
    public function getAllTransactions()
    {
        return $this->findAll(); // Returns all rows
    }

    // Fetch transactions filtered by status
    public function getTransactionsByStatus($status)
    {
        return $this->where('status', $status)->findAll();
    }
}
