- 134-tool registry with programmatic SEO (unique titles/H1/descriptions, JSON-LD graphs, sitemap index, canonical 301 enforcement via required filter) - DB-backed job queue (SKIP LOCKED) with drivers: Ffmpeg, Images (GD), Pdf (qpdf/gs/poppler), Youtube (thumbnails), Qr (server-side PNG) - Security: SSRF guard, MIME validation, rate limits, API-key auth, bcrypt admin login, security headers - Admin panel: dashboard, tools/categories/guides CRUD, SEO audit, analytics, job inspector with retry, system health, feature flags - Docker deployment (nginx + web/api FPM pools + scalable workers), PHPUnit suite (19 tests / 1139 assertions), PWA manifest + service worker
35 lines
840 B
PHP
35 lines
840 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
final class SettingModel extends Model
|
|
{
|
|
protected $table = 'settings';
|
|
protected $primaryKey = 'key';
|
|
protected $returnType = 'array';
|
|
protected $useTimestamps = false;
|
|
protected $allowedFields = ['key', 'value', 'updated_at'];
|
|
|
|
public function get(string $key, ?string $default = null): ?string
|
|
{
|
|
$row = $this->find($key);
|
|
|
|
return $row === null ? $default : (string) $row['value'];
|
|
}
|
|
|
|
public function put(string $key, string $value): void
|
|
{
|
|
$this->db->table($this->table)->upsert(['key' => $key, 'value' => $value]);
|
|
}
|
|
|
|
/** @return array<string,string> */
|
|
public function all(): array
|
|
{
|
|
return array_column($this->findAll() ?: [], 'value', 'key');
|
|
}
|
|
}
|