public function searchCategory($name) { $category = Category::SearchCategory($name)->first(); $articles = $category->articles()->paginate(4); $articles->each(function ($articles) { $articles->category; $articles->images; }); return view('front.article', compact('articles')); }
public function searchCategory($name) { $category = Category::SearchCategory($name)->first(); $articles = $category->articles()->paginate(10); $articles->each(function ($articles) { $articles->category; $articles->images; }); return view('front.index')->with('articles', $articles); }
public function searchCategory($name) { $category = Category::SearchCategory($name)->first(); $articles = $category->articles()->paginate(15); $images = Image::orderBy('id', 'ASC')->paginate(4); $articles->each(function ($articles) { $articles->category; $articles->images; }); return view('vistas.index')->with('articles', $articles)->with('images', $images); }
public function searchCategory($name) { //dd($name); // llamamos al scope, y nos traemos los datos $category = Category::SearchCategory($name)->first(); $articles = $category->articles()->paginate(4); //dd($articles); $articles->each(function ($articles) { $articles->category; $articles->images; }); return view('front.index')->with('articles', $articles); }