This commit is contained in:
2025-06-27 17:04:25 +08:00
parent c30ff3cca1
commit c8eb5f33ee
8 changed files with 147 additions and 46 deletions
+12
View File
@@ -2,6 +2,8 @@
namespace app\apis\model;
use app\console\model\AdminsModel;
use app\console\model\CommentModel;
use support\Model;
/**
@@ -53,4 +55,14 @@ class ArticleModel extends Model
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function comment()
{
return $this->hasMany(CommentModel::class, 'article_id', 'id');
}
public function creater()
{
return $this->belongsTo(AdminsModel::class, 'user_id','id');
}
}