public function index() { $articles = Article::OrderBy('id', 'DESC')->paginate(3); $articles->each(function ($articles) { $articles->category; $articles->images; $articles->lists('category_id'); }); $categories = Category::OrderBy('name', 'ASC')->get(); $tags = Tag::orderBy('name', 'ASC')->get(); return view('front.index')->with('articles', $articles)->with('tags', $tags)->with('categories', $categories); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $categories = Category::OrderBy('id', 'ASC')->paginate(5); return view('admin.categories.index')->with('categories', $categories); }