Sfoglia il codice sorgente

修改b端:获取资讯列表的接口---还原代码---新闻表模型适应性修改

FengR 1 mese fa
parent
commit
6dfbb2eaee
1 ha cambiato i file con 15 aggiunte e 0 eliminazioni
  1. 15 0
      app/Model/Article.php

+ 15 - 0
app/Model/Article.php

@@ -15,6 +15,21 @@ class Article extends Model
      */
     protected ?string $table = 'article';
 
+    /**
+     * 定义与分类的多对一关系
+     */
+    public function category()
+    {
+        return $this->belongsTo(Category::class, 'category_id', 'id');
+    }
+    /**
+     * 定义与分类的多对一关系
+     */
+    public function websiteCategory()
+    {
+        return $this->belongsTo(WebsiteCategory::class, 'category_id', 'id');
+    }
+
     /**
      * The attributes that are mass assignable.
      */