'integer', 'sort' => 'integer', 'status' => 'integer', 'created_at' => 'datetime:Y-m-d H:i:s', 'updated_at' => 'datetime:Y-m-d H:i:s', ]; protected $appends = ['image_url']; protected $with = ['image']; /** * 关联图标 */ public function image(): HasOne { return $this->hasOne(SysFileModel::class, 'id', 'image_id'); } /** * 图标链接 */ public function getImageUrlAttribute(): ?string { return $this->image?->preview_url; } }