|
|
@@ -22,6 +22,8 @@ class ArticleModel extends BaseModel
|
|
|
// 设置数据表
|
|
|
protected $table = 'article';
|
|
|
|
|
|
+// protected $appends = ['time_text'];
|
|
|
+
|
|
|
|
|
|
// 封面图
|
|
|
public function getCoverAttribute($value)
|
|
|
@@ -36,6 +38,12 @@ class ArticleModel extends BaseModel
|
|
|
return $value ? get_image_path($value) : '';
|
|
|
}
|
|
|
|
|
|
+ // 时间
|
|
|
+ public function getTimeTextAttribute()
|
|
|
+ {
|
|
|
+ return $this->create_time ? dateFormat(strtotime($this->create_time)) : '';
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 分类
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|