public function attributesToDefaultFormat($event)
    {
        $oldAttributes = $this->owner->oldAttributes;
        foreach ($this->attributes as $attribute) {
            $oldAttributeValue = $oldAttributes[$attribute];

            if ($this->owner->$attribute instanceof Carbon) {
                //If old attribute value is an integer, then we convert the current attribute value to the timestamp for prevent db errors
                if (is_numeric($oldAttributeValue)) {
                    $this->owner->$attribute = $this->owner->$attribute->timestamp;
                }
            }
        }
    }
public function attributesToDefaultFormat($event)
    {
        $oldAttributes = $this->owner->oldAttributes;
        foreach ($this->attributes as $attribute) {
            $oldAttributeValue = $oldAttributes[$attribute];

            if ($this->owner->$attribute instanceof Carbon) {
                //If old attribute value is an integer, then we convert the current attribute value to the timestamp for prevent db errors
                if (is_numeric($oldAttributeValue)) {
                    $this->owner->$attribute = $this->owner->$attribute->timestamp;
                }
            }
        }
    }
public function attributesToDefaultFormat ( $ event ) { $ oldAttributes = $ this -> owner -> oldAttributes ; foreach ( $ this -> attributes as $ attribute ) { $ oldAttributeValue = $ oldAttributes [ $ attribute ] ; if ( $ this -> owner -> $ attribute instanceof Carbon ) { //If old attribute value is an integer, then we convert the current attribute value to the timestamp for prevent db errors if ( is_numeric ( $ oldAttributeValue ) ) { $ this -> owner -> $ attribute = $ this -> owner -> $ attribute -> timestamp ; } } } }
Handles owner 'beforeUpdate' event for converting attributes values to the default format

@param $event

@return bool
Handles owner beforeUpdate event for converting attributes values to the default format