Current state

This commit is contained in:
2026-02-07 08:23:18 +01:00
commit 0a4372c40d
22479 changed files with 1553543 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
<?php
namespace App\Http\Controllers;
use App\Models\Category;
use App\Models\ContentType;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
class CategoryPageController extends Controller
{
public function show(Request $request, string $contentTypeSlug, string $categoryPath = null)
{
$contentType = ContentType::where('slug', strtolower($contentTypeSlug))->first();
if (! $contentType) {
abort(404);
}
if ($categoryPath === null || $categoryPath === '') {
// No category path: show content-type landing page (e.g., /wallpapers)
$rootCategories = $contentType->rootCategories()->orderBy('sort_order')->orderBy('name')->get();
$page_title = $contentType->name;
$page_meta_description = $contentType->description ?? ($contentType->name . ' artworks on Skinbase');
return view('legacy.content-type', compact(
'contentType',
'rootCategories',
'page_title',
'page_meta_description'
));
}
$segments = array_filter(explode('/', $categoryPath));
if (empty($segments)) {
return redirect('/browse-categories');
}
// Traverse categories by slug path within the content type
$current = Category::where('content_type_id', $contentType->id)
->whereNull('parent_id')
->where('slug', strtolower(array_shift($segments)))
->first();
if (! $current) {
abort(404);
}
foreach ($segments as $slug) {
$current = $current->children()->where('slug', strtolower($slug))->first();
if (! $current) {
abort(404);
}
}
$category = $current;
$subcategories = $category->children()->orderBy('sort_order')->orderBy('name')->get();
$rootCategories = $contentType->rootCategories()->orderBy('sort_order')->orderBy('name')->get();
// Placeholder artworks paginator (until artwork data is wired).
$page = max(1, (int) $request->query('page', 1));
$artworks = new LengthAwarePaginator([], 0, 40, $page, [
'path' => $request->url(),
'query' => $request->query(),
]);
$page_title = $category->name;
$page_meta_description = $category->description ?? ($contentType->name . ' artworks on Skinbase');
$page_meta_keywords = strtolower($contentType->slug) . ', skinbase, artworks, wallpapers, skins, photography';
return view('legacy.category-slug', compact(
'contentType',
'category',
'subcategories',
'rootCategories',
'artworks',
'page_title',
'page_meta_description',
'page_meta_keywords'
));
}
}