wesmiler 2 tháng trước cách đây
mục cha
commit
4706875293
1 tập tin đã thay đổi với 14 bổ sung0 xóa
  1. 14 0
      app/Models/ArticleModel.php

+ 14 - 0
app/Models/ArticleModel.php

@@ -22,6 +22,20 @@ class ArticleModel extends BaseModel
     // 设置数据表
     protected $table = 'article';
 
+
+    // 封面图
+    public function getCoverAttribute($value)
+    {
+        $value = $value ? get_image_url($value) : '';
+        return $value;
+    }
+
+    public function setCoverAttribute($value)
+    {
+
+        return $value ? get_image_path($value) : '';
+    }
+
     /**
      * 分类
      * @return \Illuminate\Database\Eloquent\Relations\HasOne