Update Media model

pull/547/head
Daniel Supernault 7 years ago
parent 3b7127ba32
commit fb24f382c0
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7

@ -19,8 +19,12 @@ class Media extends Model
public function url()
{
$path = $this->media_path;
$url = Storage::url($path);
if(!empty($this->remote_media) && $this->remote_url) {
$url = $this->remote_url;
} else {
$path = $this->media_path;
$url = Storage::url($path);
}
return url($url);
}
@ -60,4 +64,15 @@ class Media extends Model
{
return json_decode($this->metadata, true, 3);
}
public function getModel()
{
if(empty($this->metadata)) {
return false;
}
$meta = $this->getMetadata();
if($meta && isset($meta['Model'])) {
return $meta['Model'];
}
}
}

Loading…
Cancel
Save