<?php

namespace App\Models;

use CodeIgniter\Model;

class LoginActivityModel extends Model
{
    protected $table = 'login_activity';
    protected $primaryKey = 'id';
    protected $allowedFields = [
        'user_id', 
        'email', 
        'login_time', 
        'logout_time', 
        'ip_address', 
        'user_agent',
        'semester',
        'created_at',
        'updated_at'
    ];
    
    protected $useTimestamps = true;
    protected $createdField = 'created_at';
    protected $updatedField = 'updated_at';

    public function getLastActivities($limit = 4)
    {
        return $this->orderBy('login_time', 'DESC')->findAll($limit);
    }



}


?>
