<?php

namespace App\Models;

use CodeIgniter\Model;

class LoginModel extends Model
{
    protected $table = 'admin'; // Nama tabel di database
    protected $primaryKey = 'id_admin'; // Primary key tabel
    protected $allowedFields = ['nama_admin', 'email_admin', 'password_admin', 'gambar_admin']; // Kolom yang dapat diisi

    // Mendapatkan data pengguna berdasarkan email
    public function getUserByEmail($email)
    {
        return $this->where('email_admin', $email)->first();
    }
}