示例#1
0
 public function postCastingFeedback()
 {
     if (!Request::ajax()) {
         return App::abort(404);
     }
     $json_request = array('status' => FALSE, 'responseText' => '', 'responseErrorText' => '', 'redirect' => FALSE);
     $validation = Validator::make(Input::all(), Casting::$rules);
     if ($validation->passes()) {
         Casting::create(Input::all());
         $json_request['responseText'] = 'Сообщение отправлено';
         $json_request['status'] = TRUE;
     } else {
         $json_request['responseText'] = 'Неверно заполнены поля';
         $json_request['responseErrorText'] = implode($validation->messages()->all(), '<br />');
     }
     return Response::json($json_request, 200);
 }