laravel-blog
laravel-blog copied to clipboard
viewSinglePost fails when a post is unpublished
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.