Skip to content

Commit 95c18df

Browse files
Added Image Attribute
Due to this function images can show in frontend and admin both.
1 parent 84e9191 commit 95c18df

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Modules/Page/Entities/Page.php

+11
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,15 @@ public function __call($method, $parameters)
7777
#i: No relation found, return the call to parent (Eloquent) to handle it.
7878
return parent::__call($method, $parameters);
7979
}
80+
81+
public function getImageAttribute()
82+
{
83+
$thumbnail = $this->files()->where('zone', 'image')->first();
84+
85+
if ($thumbnail === null) {
86+
return '';
87+
}
88+
89+
return $thumbnail;
90+
}
8091
}

0 commit comments

Comments
 (0)