Unverified Commit 31bec710 authored by Nicolas Widart's avatar Nicolas Widart Committed by GitHub

Merge pull request #578 from chiragpipariya/patch-3

Added Image Attribute
parents 84e91910 95c18df1
......@@ -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