Update Media Model

This commit is contained in:
Daniel Supernault 2019-01-21 12:18:08 -07:00
parent cd6b66b8e6
commit d34eb425b0
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -17,6 +17,16 @@ class Media extends Model
*/
protected $dates = ['deleted_at'];
public function status()
{
return $this->belongsTo(Status::class);
}
public function profile()
{
return $this->belongsTo(Profile::class);
}
public function url()
{
if(!empty($this->remote_media) && $this->remote_url) {
@ -37,6 +47,11 @@ class Media extends Model
return url($url);
}
public function thumb()
{
return $this->thumbnailUrl();
}
public function mimeType()
{
return explode('/', $this->mime)[0];