prepared and gallery fixes
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\CategoryPageController;
|
||||
use App\Http\Controllers\Web\BrowseGalleryController;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\ArtworkIndexRequest;
|
||||
use App\Models\Artwork;
|
||||
use App\Models\Category;
|
||||
use App\Services\Recommendations\SimilarArtworksService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
@@ -71,15 +70,27 @@ class ArtworkController extends Controller
|
||||
$foundArtwork = Artwork::where('slug', $artworkSlug)->first();
|
||||
}
|
||||
|
||||
// When the URL can represent a nested category path (e.g. /skins/audio/winamp),
|
||||
// prefer category rendering over artwork slug collisions so same-level groups
|
||||
// behave consistently.
|
||||
if (! empty($artworkSlug)) {
|
||||
$combinedPath = trim($categoryPath . '/' . $artworkSlug, '/');
|
||||
$resolvedCategory = Category::findByPath($contentTypeSlug, $combinedPath);
|
||||
if ($resolvedCategory) {
|
||||
return app(BrowseGalleryController::class)->content(request(), $contentTypeSlug, $combinedPath);
|
||||
}
|
||||
}
|
||||
|
||||
// If no artwork was found, treat the request as a category path.
|
||||
// The route places the artwork slug in the last segment, so include it
|
||||
// when forwarding to CategoryPageController to support arbitrary-depth paths
|
||||
// The route places the artwork slug in the last segment, so include it.
|
||||
// Delegate to BrowseGalleryController to render the same modern gallery
|
||||
// layout used by routes like /skins/audio.
|
||||
if (! $foundArtwork) {
|
||||
$combinedPath = $categoryPath;
|
||||
if ($artworkSlug) {
|
||||
$combinedPath = trim($categoryPath . '/' . $artworkSlug, '/');
|
||||
}
|
||||
return app(CategoryPageController::class)->show(request(), $contentTypeSlug, $combinedPath);
|
||||
return app(BrowseGalleryController::class)->content(request(), $contentTypeSlug, $combinedPath);
|
||||
}
|
||||
|
||||
if (! $foundArtwork->is_public || ! $foundArtwork->is_approved || $foundArtwork->trashed()) {
|
||||
|
||||
Reference in New Issue
Block a user