- 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
58 lines
1.8 KiB
PHP
58 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controllers\Admin;
|
|
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
|
|
/** Categories CRUD (compact). */
|
|
final class CategoriesAdmin extends AdminBase
|
|
{
|
|
public function index(): string
|
|
{
|
|
return $this->render('categories_index', ['categories' => $this->categories()]);
|
|
}
|
|
|
|
public function store(): ResponseInterface
|
|
{
|
|
$post = $this->request->getPost();
|
|
model(\App\Models\CategoryModel::class)->insert([
|
|
'slug' => $post['slug'],
|
|
'name' => $post['name'],
|
|
'tagline' => $post['tagline'] ?? null,
|
|
'icon' => $post['icon'] ?? 'tool',
|
|
'seo_title' => $post['seo_title'] ?? null,
|
|
'seo_description' => $post['seo_description'] ?? null,
|
|
'sort_order' => (int) ($post['sort_order'] ?? 99),
|
|
'is_active' => 1,
|
|
]);
|
|
service('cache')->clear();
|
|
|
|
return redirect()->to('/admin/categories');
|
|
}
|
|
|
|
public function edit(int $id): string
|
|
{
|
|
return $this->render('categories_form', [
|
|
'category' => model(\App\Models\CategoryModel::class)->find($id),
|
|
]);
|
|
}
|
|
|
|
public function update(int $id): ResponseInterface
|
|
{
|
|
$post = $this->request->getPost();
|
|
model(\App\Models\CategoryModel::class)->update($id, [
|
|
'name' => $post['name'],
|
|
'tagline' => $post['tagline'] ?? null,
|
|
'icon' => $post['icon'] ?? 'tool',
|
|
'seo_title' => $post['seo_title'] ?? null,
|
|
'seo_description' => $post['seo_description'] ?? null,
|
|
'sort_order' => (int) ($post['sort_order'] ?? 99),
|
|
]);
|
|
service('cache')->clear();
|
|
|
|
return redirect()->to('/admin/categories');
|
|
}
|
|
}
|