public function searchTag($name) { $tag = Tag::Search($name)->first(); $articles = $tag->articles()->paginate(4); $articles->each(function ($articles) { $articles->category; $articles->images; }); return view('front.index')->with('articles', $articles); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { $tags = Tag::Search($request->name)->orderBy('id', 'ASC')->paginate(5); return view('admin.tags.index')->with('tags', $tags); }