/**
  * 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'));
 }
Exemplo n.º 2
0
 public function index()
 {
     $articles = article::latest()->published()->get();
     return view('pages.articles.articles', compact('articles'));
 }