@@ -64,10 +64,10 @@ |
||
64 | 64 | public function revert() |
65 | 65 | { |
66 | 66 | $model = $this->getModel(); |
67 | - unset( $model->{$model->getCreatedAtColumn()} ); |
|
68 | - unset( $model->{$model->getUpdatedAtColumn()} ); |
|
67 | + unset($model->{$model->getCreatedAtColumn()} ); |
|
68 | + unset($model->{$model->getUpdatedAtColumn()} ); |
|
69 | 69 | if (method_exists($model, 'getDeletedAtColumn')) { |
70 | - unset( $model->{$model->getDeletedAtColumn()} ); |
|
70 | + unset($model->{$model->getDeletedAtColumn()} ); |
|
71 | 71 | } |
72 | 72 | $model->save(); |
73 | 73 | return $model; |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public static function bootVersionableTrait() |
73 | 73 | { |
74 | - static::saving(function ($model) { |
|
74 | + static::saving(function($model) { |
|
75 | 75 | $model->versionablePreSave(); |
76 | 76 | }); |
77 | 77 | |
78 | - static::saved(function ($model) { |
|
78 | + static::saved(function($model) { |
|
79 | 79 | $model->versionablePostSave(); |
80 | 80 | }); |
81 | 81 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * We'll save new versions on updating and first creation |
148 | 148 | */ |
149 | 149 | if ( |
150 | - ( $this->versioningEnabled === true && $this->updating && $this->isValidForVersioning() ) || |
|
151 | - ( $this->versioningEnabled === true && !$this->updating ) |
|
150 | + ($this->versioningEnabled === true && $this->updating && $this->isValidForVersioning()) || |
|
151 | + ($this->versioningEnabled === true && !$this->updating) |
|
152 | 152 | ) { |
153 | 153 | // Save a new version |
154 | 154 | $version = new Version(); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $version->user_id = $this->getAuthUserId(); |
158 | 158 | $version->model_data = serialize($this->getAttributes()); |
159 | 159 | |
160 | - if (!empty( $this->reason )) { |
|
160 | + if (!empty($this->reason)) { |
|
161 | 161 | $version->reason = $this->reason; |
162 | 162 | } |
163 | 163 | |
@@ -172,14 +172,14 @@ discard block |
||
172 | 172 | */ |
173 | 173 | private function isValidForVersioning() |
174 | 174 | { |
175 | - $dontVersionFields = isset( $this->dontVersionFields ) ? $this->dontVersionFields : []; |
|
176 | - $removeableKeys = array_merge($dontVersionFields, [$this->getUpdatedAtColumn()]); |
|
175 | + $dontVersionFields = isset($this->dontVersionFields) ? $this->dontVersionFields : [ ]; |
|
176 | + $removeableKeys = array_merge($dontVersionFields, [ $this->getUpdatedAtColumn() ]); |
|
177 | 177 | |
178 | 178 | if (method_exists($this, 'getDeletedAtColumn')) { |
179 | - $removeableKeys[] = $this->getDeletedAtColumn(); |
|
179 | + $removeableKeys[ ] = $this->getDeletedAtColumn(); |
|
180 | 180 | } |
181 | 181 | |
182 | - return ( count(array_diff_key($this->versionableDirtyData, array_flip($removeableKeys))) > 0 ); |
|
182 | + return (count(array_diff_key($this->versionableDirtyData, array_flip($removeableKeys))) > 0); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |