'int', 'status' => 'int', 'sort' => 'int', 'image_id' => 'int', 'tag' => 'array', ]; protected $fillable = [ 'category_id', 'title', 'image_id', 'link', 'tag', 'status', 'sort', ]; protected $with = ['image']; /** * 关联图片 * @return HasOne */ public function image(): HasOne { return $this->hasOne(SysFileModel::class, 'id', 'image_id'); } /** * 关联所属分类 * @return BelongsTo */ public function category(): BelongsTo { return $this->belongsTo(SysCategoryModel::class, 'category_id', 'id'); } }