Exemplo n.º 1
0
 /**
  * Store a newly created reportfield in storage.
  *
  * @return Response
  */
 public function store($report_id)
 {
     $data = Input::all();
     ReportField::setRules('store');
     if (!ReportField::canCreate()) {
         return $this->_access_denied();
     }
     $reportfield = new Reportfield();
     $data['report_id'] = $report_id;
     $reportfield->fill($data);
     if (!$reportfield->save()) {
         return $this->_validation_error($reportfield);
     }
     if (Request::ajax()) {
         return Response::json($reportfield, 201);
     }
     return Redirect::action('ReportFieldsController@index', $report_id)->with('notification:success', $this->created_message);
 }