forked from mirror/pixelfed
Update Media model
This commit is contained in:
parent
3b7127ba32
commit
fb24f382c0
1 changed files with 17 additions and 2 deletions
|
@ -19,8 +19,12 @@ class Media extends Model
|
||||||
|
|
||||||
public function url()
|
public function url()
|
||||||
{
|
{
|
||||||
|
if(!empty($this->remote_media) && $this->remote_url) {
|
||||||
|
$url = $this->remote_url;
|
||||||
|
} else {
|
||||||
$path = $this->media_path;
|
$path = $this->media_path;
|
||||||
$url = Storage::url($path);
|
$url = Storage::url($path);
|
||||||
|
}
|
||||||
|
|
||||||
return url($url);
|
return url($url);
|
||||||
}
|
}
|
||||||
|
@ -60,4 +64,15 @@ class Media extends Model
|
||||||
{
|
{
|
||||||
return json_decode($this->metadata, true, 3);
|
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…
Add table
Reference in a new issue