@@ -49,7 +49,7 @@ public function user()
4949 {
5050 $ morphPrefix = Config::get ('audit.user.morph_prefix ' , 'user ' );
5151
52- return $ this ->morphTo (__FUNCTION__ , $ morphPrefix . '_type ' , $ morphPrefix . '_id ' );
52+ return $ this ->morphTo (__FUNCTION__ , $ morphPrefix. '_type ' , $ morphPrefix. '_id ' );
5353 }
5454
5555 /**
@@ -77,37 +77,37 @@ public function resolveData(): array
7777
7878 // Metadata
7979 $ this ->data = [
80- 'audit_id ' => $ this ->getKey (),
81- 'audit_event ' => $ this ->event ,
82- 'audit_tags ' => $ this ->tags ,
80+ 'audit_id ' => $ this ->getKey (),
81+ 'audit_event ' => $ this ->event ,
82+ 'audit_tags ' => $ this ->tags ,
8383 'audit_created_at ' => $ this ->serializeDate ($ this ->{$ this ->getCreatedAtColumn ()}),
8484 'audit_updated_at ' => $ this ->serializeDate ($ this ->{$ this ->getUpdatedAtColumn ()}),
85- 'user_id ' => $ this ->getAttribute ($ morphPrefix . '_id ' ),
86- 'user_type ' => $ this ->getAttribute ($ morphPrefix . '_type ' ),
85+ 'user_id ' => $ this ->getAttribute ($ morphPrefix. '_id ' ),
86+ 'user_type ' => $ this ->getAttribute ($ morphPrefix. '_type ' ),
8787 ];
8888
8989 // add resolvers data to metadata
9090 $ resolverData = [];
9191 foreach (array_keys (Config::get ('audit.resolvers ' , [])) as $ name ) {
92- $ resolverData ['audit_ ' . $ name ] = $ this ->$ name ;
92+ $ resolverData ['audit_ ' . $ name ] = $ this ->$ name ;
9393 }
9494 $ this ->data = array_merge ($ this ->data , $ resolverData );
9595
9696 if ($ this ->user ) {
9797 foreach ($ this ->user ->getArrayableAttributes () as $ attribute => $ value ) {
98- $ this ->data ['user_ ' . $ attribute ] = $ value ;
98+ $ this ->data ['user_ ' . $ attribute ] = $ value ;
9999 }
100100 }
101101
102102 $ this ->metadata = array_keys ($ this ->data );
103103
104104 // Modified Auditable attributes
105105 foreach ($ this ->new_values ?? [] as $ key => $ value ) {
106- $ this ->data ['new_ ' . $ key ] = $ value ;
106+ $ this ->data ['new_ ' . $ key ] = $ value ;
107107 }
108108
109109 foreach ($ this ->old_values ?? [] as $ key => $ value ) {
110- $ this ->data ['old_ ' . $ key ] = $ value ;
110+ $ this ->data ['old_ ' . $ key ] = $ value ;
111111 }
112112
113113 $ this ->modified = array_diff_key (array_keys ($ this ->data ), $ this ->metadata );
@@ -118,8 +118,7 @@ public function resolveData(): array
118118 /**
119119 * Get the formatted value of an Eloquent model.
120120 *
121- * @param mixed $value
122- *
121+ * @param mixed $value
123122 * @return mixed
124123 */
125124 protected function getFormattedValue (Model $ model , string $ key , $ value )
@@ -139,12 +138,13 @@ protected function getFormattedValue(Model $model, string $key, $value)
139138 $ model ->getCasts ()
140139 ) && $ model ->getCasts ()[$ key ] == 'Illuminate\Database\Eloquent\Casts\AsArrayObject ' ) {
141140 $ arrayObject = new \Illuminate \Database \Eloquent \Casts \ArrayObject (json_decode ($ value , true ) ?: []);
141+
142142 return $ arrayObject ;
143143 }
144144
145145 // Cast to native PHP type
146146 if ($ model ->hasCast ($ key )) {
147- if ($ model ->getCastType ($ key ) == 'datetime ' ) {
147+ if ($ model ->getCastType ($ key ) == 'datetime ' ) {
148148 $ value = $ this ->castDatetimeUTC ($ model , $ value );
149149 }
150150
@@ -168,7 +168,7 @@ protected function getFormattedValue(Model $model, string $key, $value)
168168 */
169169 private function castDatetimeUTC ($ model , $ value )
170170 {
171- if (!is_string ($ value )) {
171+ if (! is_string ($ value )) {
172172 return $ value ;
173173 }
174174
@@ -198,7 +198,7 @@ private function castDatetimeUTC($model, $value)
198198 */
199199 public function getDataValue (string $ key )
200200 {
201- if (!array_key_exists ($ key , $ this ->data )) {
201+ if (! array_key_exists ($ key , $ this ->data )) {
202202 return ;
203203 }
204204
@@ -226,15 +226,14 @@ public function getDataValue(string $key)
226226 /**
227227 * Decode attribute value.
228228 *
229- * @param mixed $value
230- *
229+ * @param mixed $value
231230 * @return mixed
232231 */
233232 protected function decodeAttributeValue (Contracts \Auditable $ auditable , string $ attribute , $ value )
234233 {
235234 $ attributeModifiers = $ auditable ->getAttributeModifiers ();
236235
237- if (!array_key_exists ($ attribute , $ attributeModifiers )) {
236+ if (! array_key_exists ($ attribute , $ attributeModifiers )) {
238237 return $ value ;
239238 }
240239
@@ -263,7 +262,7 @@ public function getMetadata(bool $json = false, int $options = 0, int $depth = 5
263262 $ metadata [$ key ] = $ value ;
264263
265264 if ($ value instanceof DateTimeInterface) {
266- $ metadata [$ key ] = !is_null ($ this ->auditable ) ? $ this ->auditable ->serializeDate ($ value ) : $ this ->serializeDate ($ value );
265+ $ metadata [$ key ] = ! is_null ($ this ->auditable ) ? $ this ->auditable ->serializeDate ($ value ) : $ this ->serializeDate ($ value );
267266 }
268267 }
269268
@@ -293,11 +292,10 @@ public function getModified(bool $json = false, int $options = 0, int $depth = 5
293292 $ modified [$ attribute ][$ state ] = $ value ;
294293
295294 if ($ value instanceof DateTimeInterface) {
296- $ modified [$ attribute ][$ state ] = !is_null ($ this ->auditable ) ? $ this ->auditable ->serializeDate ($ value ) : $ this ->serializeDate ($ value );
295+ $ modified [$ attribute ][$ state ] = ! is_null ($ this ->auditable ) ? $ this ->auditable ->serializeDate ($ value ) : $ this ->serializeDate ($ value );
297296 }
298297 }
299298
300-
301299 if (! $ json ) {
302300 return $ modified ;
303301 }
@@ -312,6 +310,6 @@ public function getModified(bool $json = false, int $options = 0, int $depth = 5
312310 */
313311 public function getTags (): array
314312 {
315- return preg_split ('/,/ ' , $ this ->tags , -1 , PREG_SPLIT_NO_EMPTY )?: [];
313+ return preg_split ('/,/ ' , $ this ->tags , -1 , PREG_SPLIT_NO_EMPTY ) ?: [];
316314 }
317315}
0 commit comments