laravel-blog icon indicating copy to clipboard operation
laravel-blog copied to clipboard

viewSinglePost fails when a post is unpublished

Open bagdaddy opened this issue 3 years ago • 0 comments

When I unpublish a post and try to access it via url, the code breaks on $categories = $blogPost->post->categories()->with([ 'categoryTranslations' => function ($query) use ($request) { $query->where("lang_id", '=', $request->get("lang_id")); } ])->get(); because $blogPost->post is null. Would be nice if this was handled and an exception was thrown or a 404 page was returned.

bagdaddy avatar Jan 14 '22 09:01 bagdaddy