classes/Models/Change.php
public static function log(Model $model, $action, Admin $admin = null)
    {
        // Create a new change instance
        if (static::shouldWriteChange($model, $action)) {
            $changed = static::getChanged($model, $action);
            $change = static::createLog($model, $action, $admin, $changed);
        }

        // Log published / unpblished changes
        static::logPublishingChange($model, $action, $admin);

        // If the action was a deletion, mark all of the records for this model as
        // deleted
        if ($action == 'deleted') {
            DB::table('changes')
                ->where('model', get_class($model))
                ->where('key', $model->getKey())
                ->update(['deleted' => 1]);
        }

        // Return the changed instance
        if (isset($change)) {
            return $change;
        }
    }
public static function log(Model $model, $action, Admin $admin = null)
    {
        // Create a new change instance
        if (static::shouldWriteChange($model, $action)) {
            $changed = static::getChanged($model, $action);
            $change = static::createLog($model, $action, $admin, $changed);
        }

        // Log published / unpblished changes
        static::logPublishingChange($model, $action, $admin);

        // If the action was a deletion, mark all of the records for this model as
        // deleted
        if ($action == 'deleted') {
            DB::table('changes')
                ->where('model', get_class($model))
                ->where('key', $model->getKey())
                ->update(['deleted' => 1]);
        }

        // Return the changed instance
        if (isset($change)) {
            return $change;
        }
    }
public static function log ( Model $ model , $ action , Admin $ admin = null ) { // Create a new change instance if ( static :: shouldWriteChange ( $ model , $ action ) ) { $ changed = static :: getChanged ( $ model , $ action ) ; $ change = static :: createLog ( $ model , $ action , $ admin , $ changed ) ; } // Log published / unpblished changes static :: logPublishingChange ( $ model , $ action , $ admin ) ; // If the action was a deletion, mark all of the records for this model as // deleted if ( $ action == 'deleted' ) { DB :: table ( 'changes' ) -> where ( 'model' , get_class ( $ model ) ) -> where ( 'key' , $ model -> getKey ( ) ) -> update ( [ 'deleted' => 1 ] ) ; } // Return the changed instance if ( isset ( $ change ) ) { return $ change ; } }
A convenience method for saving a change instance

@param  Model  $model  The model being touched
@param  string $action Generally a CRUD verb: "created", "updated", "deleted"
@param  Admin  $admin  The admin acting on the record
@return static|void
A convenience method for saving a change instance