<?php

namespace App\Models;

use CodeIgniter\Model;

class LoginModel extends Model
{
    protected $DBGroup = 'default';

    public function verify($username, $password)
    {
        // Admin table
        $admin = $this->db->table('tbl_management')
            ->where('username', $username)
            ->where('password', $password)
            ->get()
            ->getRow();

        if ($admin) {
            return $admin;
        }

        // Users table
        return $this->db->table('tbl_users')
            ->where('username', $username)
            ->where('password', $password)
            ->get()
            ->getRow();
    }
}
?>