app/controllers/PostsController.php
/**
	 * Display a listing of the resource.
	 *
	 * @return Response
	 */
Display a listing of the resource.
@return Response
Display a listing of the resource . @return Response
public function index()
	{
		$posts = Post::with('user')->orderBy('created_at', 'desc')->paginate(6);
		if (Input::has('search'))
		{
			$search =  Input::get('search');
			$posts = Post::with('user')->where("title", "LIKE", "%$search%")->paginate(6);
		}
		return View::make('posts.index')->with('posts', $posts);
	}
public function index ( ) { $ posts = Post :: with ( 'user' ) -> orderBy ( 'created_at' , 'desc' ) -> paginate ( 6 ) ; if ( Input :: has ( 'search' ) ) { $ search = Input :: get ( 'search' ) ; $ posts = Post :: with ( 'user' ) -> where ( " title " , " LIKE " , " % $ search % " ) -> paginate ( 6 ) ; } return View :: make ( 'posts.index' ) -> with ( 'posts' , $ posts ) ; }
Display a listing of the resource.
Display a listing of the resource .