public function detail($id) { $article = Blog::with('user')->where('id', '=', $id)->first(); if (!$article) { return 'MAKALE BULUNAMADI!'; } return View::make('blog.detail', compact('article')); }
public function index() { $blogs = Blog::with('author')->orderBy('created_at', 'desc')->take(10)->get(); $events = Events::with('author')->orderBy('created_at', 'desc')->take(8)->get(); $groups = Group::with('author')->orderBy('created_at', 'desc')->take(8)->get(); $photos = Photo::with('author')->orderBy('created_at', 'desc')->take(8)->get(); return View::make('home.index')->with('blogs', $blogs)->with('events', $events)->with('groups', $groups)->with('photos', $photos); }
public function action_index() { // lets get our posts and eager load the // author $blogs = Blog::with('author')->order_by('created_at', 'desc')->take(10)->get(); // show the home view, and include our // posts too //$posts->appends(array('a' => 'app')); return View::make('home.index')->with('blogs', $blogs); }
public function index() { //博客首页 $blogs = Blog::with('author')->orderBy('created_at', 'desc')->paginate(20); return View::make('blog.index')->with('blogs', $blogs); }