Merge branch 'feature/article' into develop

This commit is contained in:
2025-06-27 15:25:17 +08:00
18 changed files with 822 additions and 73 deletions
+5
View File
@@ -54,6 +54,11 @@ 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');
+56
View File
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* CommentModel
*/
class CommentAvatarModel extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'hs_comment_avatar';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = true;
/**
* 模型的数据字段的保存格式。
*
* @var string
*/
protected $dateFormat = 'U';
/**
* 允许自动填充模型字段
*/
protected $fillable = [];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
+56
View File
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* CommentModel
*/
class CommentModel extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'hs_comment';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = true;
/**
* 模型的数据字段的保存格式。
*
* @var string
*/
protected $dateFormat = 'U';
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'article_id', 'content', 'avatar', 'name', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}