Пример #1
0
 public function index()
 {
     $posts = Post::with('category', 'comments', 'tags', 'user')->orderBy('created_at', 'desc')->paginate(10);
     $latestPosts = $posts->take(5)->all();
     $categories = Category::all();
     $tags = Tag::all();
     return view('pages.home')->with(['posts' => $posts, 'latestPosts' => $latestPosts, 'categories' => $categories, 'tags' => $tags]);
 }
Пример #2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $posts = Post::with('category', 'tags', 'comments')->get();
     return view('admin.post.index')->with('posts', $posts);
 }