public function toArray($withTranslations = true)
    {
        $attributes = parent::toArray();

        if ($withTranslations && $this->hasTranslatedAttributes()) {
            foreach ($this->getTranslatedAttributes() as $field) {
                if ($translations = $this->getTranslation()) {
                    $attributes[$field] = $translations->$field;
                }
            }
        }

        return $attributes;
    }
public function toArray($withTranslations = true)
    {
        $attributes = parent::toArray();

        if ($withTranslations && $this->hasTranslatedAttributes()) {
            foreach ($this->getTranslatedAttributes() as $field) {
                if ($translations = $this->getTranslation()) {
                    $attributes[$field] = $translations->$field;
                }
            }
        }

        return $attributes;
    }
public function toArray ( $ withTranslations = true ) { $ attributes = parent :: toArray ( ) ; if ( $ withTranslations && $ this -> hasTranslatedAttributes ( ) ) { foreach ( $ this -> getTranslatedAttributes ( ) as $ field ) { if ( $ translations = $ this -> getTranslation ( ) ) { $ attributes [ $ field ] = $ translations -> $ field ; } } } return $ attributes ; }
Cast model to array

@param bool $withTranslations - include translated columns or not
@return array
Cast model to array