Example #1
0
 public function index()
 {
     $articles = Article::paginate(20);
     if (Request::ajax()) {
         return \Response::json(view("blog", compact("articles"))->render());
     }
     return view("blog", compact("articles"));
 }
Example #2
0
 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function index()
 {
     $perPage = 2;
     $article = Article::paginate($perPage);
     $maxPage = intval(ceil(Article::count() / $perPage));
     $firstArticle = $article->shift();
     $others = $article;
     return view('home')->with(['first' => $firstArticle, 'others' => $others, 'maxPage' => $maxPage]);
     /*$categories = Category::all();
       $articles = Article::paginate(15);
       return view('home')->withArticles($articles)->withCategories($categories);*/
 }
Example #3
0
 public function index()
 {
     if (empty(Input::get('category'))) {
         $categories = Category::all();
         $articles = Article::paginate(15);
         return view('article.index')->withArticles($articles)->withCategories($categories);
     } else {
         $category = Input::get('category');
         $articles = Category::where('name', $category)->article;
         return view('article.index')->withArticles($articles)->withCategories($category);
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return view('admin.articles.index')->with('articles', Article::paginate(10));
 }