public function setSingleTableType() {
    $modelClass = get_class($this);
    $classType = property_exists($modelClass, 'singleTableType') ? $modelClass::$singleTableType : null;
    if ($classType !== null) {
      if ($this->hasGetMutator(static::$singleTableTypeField)) {
        $this->{static::$singleTableTypeField} = $this->mutateAttribute(static::$singleTableTypeField, $classType);
      } else {
        $this->{static::$singleTableTypeField} = $classType;
      }
    } else {
      // We'd like to be able to declare non-leaf classes in the hierarchy as abstract so they can't be instantiated and saved.
      // However, Eloquent expects to instantiate classes at various points. Therefore throw an exception if we try to save
      // and instance that doesn't have a type.
      throw new SingleTableInheritanceException('Cannot save Single table inheritance model without declaring static property $singleTableType.');
    }
  }
public function setSingleTableType() {
    $modelClass = get_class($this);
    $classType = property_exists($modelClass, 'singleTableType') ? $modelClass::$singleTableType : null;
    if ($classType !== null) {
      if ($this->hasGetMutator(static::$singleTableTypeField)) {
        $this->{static::$singleTableTypeField} = $this->mutateAttribute(static::$singleTableTypeField, $classType);
      } else {
        $this->{static::$singleTableTypeField} = $classType;
      }
    } else {
      // We'd like to be able to declare non-leaf classes in the hierarchy as abstract so they can't be instantiated and saved.
      // However, Eloquent expects to instantiate classes at various points. Therefore throw an exception if we try to save
      // and instance that doesn't have a type.
      throw new SingleTableInheritanceException('Cannot save Single table inheritance model without declaring static property $singleTableType.');
    }
  }
public function setSingleTableType ( ) { $ modelClass = get_class ( $ this ) ; $ classType = property_exists ( $ modelClass , 'singleTableType' ) ? $ modelClass :: $ singleTableType : null ; if ( $ classType !== null ) { if ( $ this -> hasGetMutator ( static :: $ singleTableTypeField ) ) { $ this -> { static :: $ singleTableTypeField } = $ this -> mutateAttribute ( static :: $ singleTableTypeField , $ classType ) ; } else { $ this -> { static :: $ singleTableTypeField } = $ classType ; } } else { // We'd like to be able to declare non-leaf classes in the hierarchy as abstract so they can't be instantiated and saved. // However, Eloquent expects to instantiate classes at various points. Therefore throw an exception if we try to save // and instance that doesn't have a type. throw new SingleTableInheritanceException ( 'Cannot save Single table inheritance model without declaring static property $singleTableType.' ) ; } }
Set the type value into the type field attribute
@throws Exceptions\SingleTableInheritanceException
Set the type value into the type field attribute