fix: Fix news.show request - Sentry LE-GAULOIS-7M

This commit is contained in:
Vincent BRIDIER 2024-12-26 09:13:00 +01:00
parent 12b667f5cf
commit b94807533b
No known key found for this signature in database
GPG key ID: 8571BFA20420D512

View file

@ -37,7 +37,7 @@ class NewsController extends Controller
public function show(string $slug): \Illuminate\Contracts\View\View
{
/** @var \App\Models\News|null $newsModel Current news model */
$newsModel = News::query()->where('slug', $slug)->with('newsCategory')->first();
$newsModel = News::query()->where('slug', $slug)->where('published', true)->with('newsCategory')->firstOrFail();
$asideNewsModels = News::query()
->orderByRaw('news_category_id = ? DESC', [$newsModel->news_category_id])
->where([