public function category(Request $request) { $type = ArticleType::where('type_en', $request->input('type'))->first(); if (!$type) { abort(404); } /*if>*/ $typeArticles = Article::where('type_id', $type->id)->orderBy('count', 'desc')->get(); if (!$typeArticles) { abort(404); } /*if>*/ return view('education.article-category', ['title' => $type->type_ch, 'articles' => $typeArticles]); }