'integer', 'last_attempt_at' => 'datetime', 'blocked_until' => 'datetime', ]; /** * Equivalent of CI getAttemptByIp() */ public static function getAttemptByIp(string $ip): ?self { return static::query() ->where('ip_address', $ip) ->first(); } /** * Equivalent of CI updateIpAttempt() */ public static function updateIpAttempt(string $ip, array $data): bool { return static::query() ->where('ip_address', $ip) ->update($data) >= 0; } /** * Equivalent of CI insertIpAttempt() * Returns inserted id. */ public static function insertIpAttempt(array $data): int { $row = static::query()->create($data); return (int) $row->id; } }