Skip to content

Commit 386ff91

Browse files
committed
Update get custom fields attribute
1 parent 3a3a325 commit 386ff91

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/OwenIt/Auditing/Log.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,10 @@ public function getCustomFieldsAttribute()
110110
if( class_exists($class = $this->owner_type) ){
111111
$customFields = [];
112112
foreach($this->getCustomFields($class) as $field => $message){
113-
// Custom message
114-
$customMessage = $this->resolveCustomMessage(
115-
array_get($message, $this->type, $message)
116-
);
117-
118-
// Check if message was custom
119-
if($customMessage){
120-
$customFields[$field] = $customMessage;
113+
if(is_array($message) && isset($message[$this->type])){
114+
$customFields[$field] = $this->resolveCustomMessage($message[$this->type]);
115+
} elseif(is_string($message)) {
116+
$customFields[$field] = $this->resolveCustomMessage($message);
121117
}
122118
}
123119

0 commit comments

Comments
 (0)