original_string: public function store()
      {
          $data = Input::all();
  
          // Handle validation errors.
          if ($validationMessages = $this->validationMessages($data)) {
              return back()->withInput()->withErrors($validationMessages);
          }
  
          if (($response = $this->prepare($data)) instanceof Response) {
              return $response;
          }
  
          DB::transaction(function () {
              $inserts = $this->prepareInsert($this->updates);
  
              foreach ($inserts as $column => $value) {
                  $this->model->setAttribute($column, $value);
              }
  
              $this->model->save();
  
              $this->updateRelation($this->relations);
          });
  
          if (($response = $this->complete($this->saved)) instanceof Response) {
              return $response;
          }
  
          if ($response = $this->ajaxResponse(trans('admin.save_succeeded'))) {
              return $response;
          }
  
          return $this->redirectAfterStore();
      }
code: public function store()
      {
          $data = Input::all();
  
          // Handle validation errors.
          if ($validationMessages = $this->validationMessages($data)) {
              return back()->withInput()->withErrors($validationMessages);
          }
  
          if (($response = $this->prepare($data)) instanceof Response) {
              return $response;
          }
  
          DB::transaction(function () {
              $inserts = $this->prepareInsert($this->updates);
  
              foreach ($inserts as $column => $value) {
                  $this->model->setAttribute($column, $value);
              }
  
              $this->model->save();
  
              $this->updateRelation($this->relations);
          });
  
          if (($response = $this->complete($this->saved)) instanceof Response) {
              return $response;
          }
  
          if ($response = $this->ajaxResponse(trans('admin.save_succeeded'))) {
              return $response;
          }
  
          return $this->redirectAfterStore();
      }
code_tokens: public function store ( ) { $ data = Input :: all ( ) ; // Handle validation errors. if ( $ validationMessages = $ this -> validationMessages ( $ data ) ) { return back ( ) -> withInput ( ) -> withErrors ( $ validationMessages ) ; } if ( ( $ response = $ this -> prepare ( $ data ) ) instanceof Response ) { return $ response ; } DB :: transaction ( function ( ) { $ inserts = $ this -> prepareInsert ( $ this -> updates ) ; foreach ( $ inserts as $ column => $ value ) { $ this -> model -> setAttribute ( $ column , $ value ) ; } $ this -> model -> save ( ) ; $ this -> updateRelation ( $ this -> relations ) ; } ) ; if ( ( $ response = $ this -> complete ( $ this -> saved ) ) instanceof Response ) { return $ response ; } if ( $ response = $ this -> ajaxResponse ( trans ( 'admin.save_succeeded' ) ) ) { return $ response ; } return $ this -> redirectAfterStore ( ) ; }
docstring: Store a new record.
  
  @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\Http\JsonResponse
docstring_tokens: Store a new record .