Files
ggdeals/app/Controllers/Franchise.php
T
deepseek fff7a4b9b9 GG.deals clone: CodeIgniter 4 + MongoDB game price tracker
- Full gg.deals-style UI: deal feed with filters, game pages with price
  history charts, rankings, vouchers, news, prepaids, subscriptions,
  bundles, franchises, wishlist, API docs
- Real data crawlers:
  * gg:crawl (Steam Store API + GOG Catalog + Epic free games)
  * gg:catalog (252K game slugs from gg.deals sitemaps)
  * gg:ggdeals (per-game prices via FlareSolverr session, JSON-LD parsing)
  * gg:seed / gg:crawl-covers (demo seed + Steam CDN cover art)
- 24/7 self-updating scheduler (scripts/scheduler_loop.php, lockfile-protected)
- Tailwind v4 dark/light theme, Alpine.js, Chart.js
2026-08-23 07:06:02 +00:00

50 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Controllers;
use App\Libraries\Mongo;
use App\Models\GameModel;
use CodeIgniter\Controller;
class Franchise extends Controller
{
public function index(string $slug): string
{
$fr = Mongo::collection('franchises')->findOne(['slug' => $slug]);
if ($fr === null) {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
}
$games = [];
foreach ($fr['games'] as $gslug) {
$g = (new GameModel())->findBySlug($gslug);
if ($g !== null) {
$games[] = $g;
}
}
$data = [
'pageTitle' => $fr['name'] . ' Franchise — GG.deals',
'franchise' => $fr,
'games' => $games,
'allFranchises' => Mongo::collection('franchises')->find([], ['sort' => ['name' => 1]])->toArray(),
];
return view('franchise', $data);
}
public function all(): string
{
$list = Mongo::collection('franchises')->find([], ['sort' => ['name' => 1]])->toArray();
$data = [
'pageTitle' => 'Franchises — GG.deals',
'franchises' => $list,
];
return view('franchises', $data);
}
}