adding validation to PostsController, edited index.blade