|
@@ -15,6 +15,21 @@ class Article extends Model
|
|
|
*/
|
|
*/
|
|
|
protected ?string $table = 'article';
|
|
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.
|
|
* The attributes that are mass assignable.
|
|
|
*/
|
|
*/
|