/** * Display a listing of the resource. * * @return Response */ public function index(Request $request) { $articles = article::latest()->get(); if ($request->ajax() || $request->wantsJson()) { return new JsonResponse($users); } return view('articles.index', compact('articles')); }
public function index() { $articles = article::latest()->published()->get(); return view('pages.articles.articles', compact('articles')); }