diff --git a/app/controllers/CommentController.php b/app/controllers/CommentController.php index 2519427..b36fb94 100644 --- a/app/controllers/CommentController.php +++ b/app/controllers/CommentController.php @@ -19,6 +19,10 @@ public function index() */ public function store() { + // Check if input values are available, else return error ++ if ( ! Input::has('author') || ! Input::has('text')) { ++ return Response::json(array('error' => 'Please fill the form properly.' )); ++ } Comment::create(array( 'author' => Input::get('author'), 'text' => Input::get('text') @@ -51,4 +55,4 @@ public function destroy($id) return Response::json(array('success' => true)); } -} \ No newline at end of file +}