original_string: protected function saving(Eloquent $user, $input = [], $type = 'create')
      {
          $beforeEvent = ($type === 'create' ? 'creating' : 'updating');
          $afterEvent = ($type === 'create' ? 'created' : 'updated');
  
          $user->fullname = $input['fullname'];
          $user->email = $input['email'];
  
          $this->fireEvent($beforeEvent, [$user]);
          $this->fireEvent('saving', [$user]);
  
          $user->transaction(function () use ($user, $input) {
              $user->save();
              $user->roles()->sync($input['roles']);
          });
  
          $this->fireEvent($afterEvent, [$user]);
          $this->fireEvent('saved', [$user]);
  
          return true;
      }
code: protected function saving(Eloquent $user, $input = [], $type = 'create')
      {
          $beforeEvent = ($type === 'create' ? 'creating' : 'updating');
          $afterEvent = ($type === 'create' ? 'created' : 'updated');
  
          $user->fullname = $input['fullname'];
          $user->email = $input['email'];
  
          $this->fireEvent($beforeEvent, [$user]);
          $this->fireEvent('saving', [$user]);
  
          $user->transaction(function () use ($user, $input) {
              $user->save();
              $user->roles()->sync($input['roles']);
          });
  
          $this->fireEvent($afterEvent, [$user]);
          $this->fireEvent('saved', [$user]);
  
          return true;
      }
code_tokens: protected function saving ( Eloquent $ user , $ input = [ ] , $ type = 'create' ) { $ beforeEvent = ( $ type === 'create' ? 'creating' : 'updating' ) ; $ afterEvent = ( $ type === 'create' ? 'created' : 'updated' ) ; $ user -> fullname = $ input [ 'fullname' ] ; $ user -> email = $ input [ 'email' ] ; $ this -> fireEvent ( $ beforeEvent , [ $ user ] ) ; $ this -> fireEvent ( 'saving' , [ $ user ] ) ; $ user -> transaction ( function ( ) use ( $ user , $ input ) { $ user -> save ( ) ; $ user -> roles ( ) -> sync ( $ input [ 'roles' ] ) ; } ) ; $ this -> fireEvent ( $ afterEvent , [ $ user ] ) ; $ this -> fireEvent ( 'saved' , [ $ user ] ) ; return true ; }
docstring: Save the user.
  
  @param  \Orchestra\Model\User  $user
  @param  array  $input
  @param  string  $type
  
  @return bool
docstring_tokens: Save the user .