Beispiel #1
0
 public function getSearch()
 {
     $keyword = Input::get('keyword');
     $posts = Post::where('enabled', '=', '1')->where('post_date', '<=', Carbon::now())->where('title', 'LIKE', '%' . $keyword . '%')->orderBy('post_date', 'DESC');
     $count = $posts->count();
     $posts = $posts->paginate(5);
     $posts->appends(['keyword' => $keyword]);
     //add "keyword" to
     return View::make('blog.pages.search')->with('posts', $posts)->with('count', $count)->with('keyword', $keyword)->with('lastposts', Post::enabled()->minimum()->take(4)->get())->with('lastcomments', Comment::enabled()->take(4)->orderBy('created_at', 'DESC')->get())->with('categories', Category::all());
 }