public function prepareAudit()
    {
        if (!isset($this->auditEnabled) || $this->auditEnabled) {
            $this->originalData = $this->original;
            $this->updatedData  = $this->attributes;

            foreach ($this->updatedData as $key => $val) {
                if (gettype($val) == 'object' && !method_exists($val, '__toString')) {
                    unset($this->originalData[$key]);
                    unset($this->updatedData[$key]);
                    array_push($this->dontKeep, $key);
                }
            }

            // Dont keep log of
            $this->dontKeep = isset($this->dontKeepLogOf) ?
                    $this->dontKeepLogOf + $this->dontKeep : $this->dontKeep;

            // Keep log of
            $this->doKeep = isset($this->keepLogOf) ?
                    $this->keepLogOf + $this->doKeep : $this->doKeep;

            unset($this->attributes['dontKeepLogOf']);
            unset($this->attributes['keepLogOf']);


            // Get changed data
            $this->dirtyData = $this->getDirty();
            // Tells whether the record exists in the database
            $this->updating  = $this->exists;
        }
    }
public function prepareAudit()
    {
        if (!isset($this->auditEnabled) || $this->auditEnabled) {
            $this->originalData = $this->original;
            $this->updatedData  = $this->attributes;

            foreach ($this->updatedData as $key => $val) {
                if (gettype($val) == 'object' && !method_exists($val, '__toString')) {
                    unset($this->originalData[$key]);
                    unset($this->updatedData[$key]);
                    array_push($this->dontKeep, $key);
                }
            }

            // Dont keep log of
            $this->dontKeep = isset($this->dontKeepLogOf) ?
                    $this->dontKeepLogOf + $this->dontKeep : $this->dontKeep;

            // Keep log of
            $this->doKeep = isset($this->keepLogOf) ?
                    $this->keepLogOf + $this->doKeep : $this->doKeep;

            unset($this->attributes['dontKeepLogOf']);
            unset($this->attributes['keepLogOf']);


            // Get changed data
            $this->dirtyData = $this->getDirty();
            // Tells whether the record exists in the database
            $this->updating  = $this->exists;
        }
    }
public function prepareAudit ( ) { if ( ! isset ( $ this -> auditEnabled ) || $ this -> auditEnabled ) { $ this -> originalData = $ this -> original ; $ this -> updatedData = $ this -> attributes ; foreach ( $ this -> updatedData as $ key => $ val ) { if ( gettype ( $ val ) == 'object' && ! method_exists ( $ val , '__toString' ) ) { unset ( $ this -> originalData [ $ key ] ) ; unset ( $ this -> updatedData [ $ key ] ) ; array_push ( $ this -> dontKeep , $ key ) ; } } // Dont keep log of $ this -> dontKeep = isset ( $ this -> dontKeepLogOf ) ? $ this -> dontKeepLogOf + $ this -> dontKeep : $ this -> dontKeep ; // Keep log of $ this -> doKeep = isset ( $ this -> keepLogOf ) ? $ this -> keepLogOf + $ this -> doKeep : $ this -> doKeep ; unset ( $ this -> attributes [ 'dontKeepLogOf' ] ) ; unset ( $ this -> attributes [ 'keepLogOf' ] ) ; // Get changed data $ this -> dirtyData = $ this -> getDirty ( ) ; // Tells whether the record exists in the database $ this -> updating = $ this -> exists ; } }
Prepare audit model.
Prepare audit model .