feat: ship creator journey v2 and profile updates

This commit is contained in:
2026-04-12 21:42:07 +02:00
parent a2457f4e49
commit d5cff21ea2
335 changed files with 20147 additions and 1545 deletions

View File

@@ -7,13 +7,16 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use App\Services\ArtworkService;
use App\Models\ContentType;
use App\Services\ContentTypes\ContentTypeSlugResolver;
class PhotographyController extends Controller
{
protected ArtworkService $artworks;
public function __construct(ArtworkService $artworks)
public function __construct(
ArtworkService $artworks,
private readonly ContentTypeSlugResolver $contentTypeResolver,
)
{
$this->artworks = $artworks;
}
@@ -21,9 +24,24 @@ class PhotographyController extends Controller
public function index(Request $request)
{
$segment = strtolower($request->segment(1) ?? 'photography');
$contentSlug = in_array($segment, ['photography','wallpapers','skins','other']) ? $segment : 'photography';
$resolution = $this->contentTypeResolver->resolve($segment);
$group = ucfirst($contentSlug);
if (! $resolution->found() || $resolution->contentType === null) {
abort(404);
}
$contentType = $resolution->contentType;
$contentSlug = strtolower((string) $contentType->slug);
if ($resolution->requiresRedirect()) {
$target = url('/' . $contentSlug);
if ($request->getQueryString()) {
$target .= '?' . $request->getQueryString();
}
return redirect()->to($target, 301);
}
$id = null;
if ($contentSlug === 'photography') {
@@ -42,9 +60,8 @@ class PhotographyController extends Controller
$category = null;
}
$ct = ContentType::where('slug', $contentSlug)->first();
$page_title = $category->category_name ?? ($ct->name ?? ucfirst($contentSlug));
$tidy = $category->description ?? ($ct->description ?? null);
$page_title = $category->category_name ?? ($contentType->name ?? ucfirst($contentSlug));
$tidy = $category->description ?? ($contentType->description ?? null);
$perPage = 40;
$sort = (string) $request->get('sort', 'latest');
@@ -70,15 +87,11 @@ class PhotographyController extends Controller
}
if (! $subcategories || $subcategories->count() === 0) {
if ($ct) {
$subcategories = $ct->rootCategories()
->orderBy('sort_order')
->orderBy('name')
->get()
->map(fn ($c) => (object) ['category_id' => $c->id, 'category_name' => $c->name, 'slug' => $c->slug]);
} else {
$subcategories = collect();
}
$subcategories = $contentType->rootCategories()
->orderBy('sort_order')
->orderBy('name')
->get()
->map(fn ($c) => (object) ['category_id' => $c->id, 'category_name' => $c->name, 'slug' => $c->slug]);
}
if ($artworks instanceof \Illuminate\Database\Eloquent\Collection || $artworks instanceof \Illuminate\Support\Collection) {
@@ -89,10 +102,7 @@ class PhotographyController extends Controller
]);
}
$contentType = ContentType::where('slug', $contentSlug)->first();
$rootCategories = $contentType
? $contentType->rootCategories()->orderBy('sort_order')->orderBy('name')->get()
: collect();
$rootCategories = $contentType->rootCategories()->orderBy('sort_order')->orderBy('name')->get();
$page_meta_description = $tidy;