add projet

This commit is contained in:
root
2026-03-05 12:29:37 -05:00
parent 8d1eef8ba8
commit 23b7db1107
9109 changed files with 1106501 additions and 73 deletions
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace App\Models;
use App\Models\BaseModel;
class IpAttempt extends BaseModel
{
protected $table = 'ip_attempts';
protected $primaryKey = 'id';
protected $fillable = [
'ip_address',
'attempts',
'last_attempt_at',
'blocked_until',
'created_at',
'updated_at',
'school_year',
'semester',
];
// Automatically handle timestamps
public $timestamps = true;
const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at';
// Validation rules
protected $validationRules = [
'ip_address' => 'required|valid_ip|max_length[45]',
'attempts' => 'required|integer',
'last_attempt_at' => 'required|valid_date',
'blocked_until' => 'permit_empty|valid_date'
];
// Method to get IP attempt data by IP address
public function getAttemptByIp($ip)
{
return $this->where('ip_address', $ip)->first();
}
// Method to update the IP attempt data
public function updateIpAttempt($ip, $data)
{
return $this->where('ip_address', $ip)->set($data)->update();
}
// Method to insert new IP attempt data
public function insertIpAttempt($data)
{
return $this->insert($data);
}
}