Skip to content

Commit 2736ae7

Browse files
Merge pull request #87 from marcoskubis/patch-3
Allow custom names for owner_type.
2 parents e3d65d2 + aee641a commit 2736ae7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Log.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function user()
5555
*/
5656
public function restore()
5757
{
58-
if (class_exists($class = $this->owner_type)) {
58+
if (class_exists($class = $this->getActualClassNameForMorph($this->owner_type))) {
5959
$model = $this->$class->findOrFail($this->owner_id);
6060

6161
$model->fill($this->old_value);
@@ -103,7 +103,7 @@ public function getElapsedTimeAttribute()
103103
*/
104104
public function getCustomMessageAttribute()
105105
{
106-
if (class_exists($class = $this->owner_type)) {
106+
if (class_exists($class = $this->getActualClassNameForMorph($this->owner_type))) {
107107
return $this->resolveCustomMessage($this->getCustomMessage($class));
108108
} else {
109109
return false;
@@ -117,7 +117,7 @@ public function getCustomMessageAttribute()
117117
*/
118118
public function getCustomFieldsAttribute()
119119
{
120-
if (class_exists($class = $this->owner_type)) {
120+
if (class_exists($class = $this->getActualClassNameForMorph($this->owner_type))) {
121121
$customFields = [];
122122

123123
foreach ($this->getCustomFields($class) as $field => $message) {

0 commit comments

Comments
 (0)