feat: ship creator journey v2 and profile updates
This commit is contained in:
@@ -3,23 +3,39 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Models\ContentType;
|
||||
use App\Services\ArtworkService;
|
||||
use App\Services\ContentTypes\ContentTypeSlugResolver;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CategoryPageController extends Controller
|
||||
{
|
||||
public function __construct(private ArtworkService $artworkService)
|
||||
public function __construct(
|
||||
private ArtworkService $artworkService,
|
||||
private ContentTypeSlugResolver $contentTypeResolver,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public function show(Request $request, string $contentTypeSlug, ?string $categoryPath = null)
|
||||
{
|
||||
$contentType = ContentType::where('slug', strtolower($contentTypeSlug))->first();
|
||||
if (! $contentType) {
|
||||
$resolution = $this->contentTypeResolver->resolve($contentTypeSlug);
|
||||
if (! $resolution->found() || $resolution->contentType === null) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$contentType = $resolution->contentType;
|
||||
|
||||
if ($resolution->requiresRedirect()) {
|
||||
$target = url('/' . trim($contentType->slug . '/' . trim((string) $categoryPath, '/'), '/'));
|
||||
$queryString = $request->getQueryString();
|
||||
|
||||
if ($queryString) {
|
||||
$target .= '?' . $queryString;
|
||||
}
|
||||
|
||||
return redirect()->to($target, 301);
|
||||
}
|
||||
|
||||
$sort = (string) $request->get('sort', 'latest');
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user