Files
alrahma_sunday_school/app/Models/LoginActivityModel.php
T
root 716cc8b8d3
Tests / PHPUnit (push) Failing after 1m20s
fix school year for all tables
2026-07-18 14:45:38 -04:00

46 lines
884 B
PHP

<?php
namespace App\Models;
use CodeIgniter\Model;
use App\Models\Concerns\SchoolYearAutoFillTrait;
class LoginActivityModel extends Model
{
use SchoolYearAutoFillTrait;
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',
'school_year',
];
protected $validationRules = [
'school_year' => 'required|string|max_length[9]',
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
public function getLastActivities($limit = 4)
{
return $this->orderBy('login_time', 'DESC')->findAll($limit);
}
}
?>