浏览代码

Update Media Model

Daniel Supernault 6 年之前
父节点
当前提交
d34eb425b0
共有 1 个文件被更改,包括 15 次插入0 次删除
  1. 15 0
      app/Media.php

+ 15 - 0
app/Media.php

@@ -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];