Unverified Commit 95c18df1 authored by Chirag Pipariya's avatar Chirag Pipariya Committed by GitHub

Added Image Attribute

Due to this function images can show in frontend and admin both.
parent 84e91910
......@@ -77,4 +77,15 @@ class Page extends Model implements TaggableInterface
#i: No relation found, return the call to parent (Eloquent) to handle it.
return parent::__call($method, $parameters);
}
public function getImageAttribute()
{
$thumbnail = $this->files()->where('zone', 'image')->first();
if ($thumbnail === null) {
return '';
}
return $thumbnail;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment