<?php
namespace App\Models;

use CodeIgniter\Model;

class UserModel extends Model
{
    protected $table = 'users';
    protected $primaryKey = 'id';
    protected $allowedFields = ['phone', 'otp', 'otp_expiry', 'apartName', 'created_at'];

    // Get all apartments
    public function getApartments()
    {
        return $this->db->table('apartmentdetails')->select('id, apartName')->get()->getResultArray();
    }

    // Get apartment by ID
    public function getApartmentById($id)
    {
        return $this->db->table('apartmentdetails')->where('id', $id)->get()->getRowArray();
    }
}
