'integer', 'visibility' => 'integer', 'status' => 'integer', 'is_top' => 'integer', 'is_recommend' => 'integer', 'allow_comment' => 'integer', 'sort' => 'integer', 'view_count' => 'integer', 'like_count' => 'integer', 'comment_count' => 'integer', 'favorite_count' => 'integer', 'published_at' => 'integer', 'offline_at' => 'integer', 'created_at' => 'integer', 'updated_at' => 'integer', 'deleted_at' => 'integer', ]; protected $appends = ['tag_names', 'tag_ids', 'category_name', 'created_date', 'updated_date', 'created_name', 'updated_name']; public function category(): BelongsTo { return $this->belongsTo(Category::class, 'category_id', 'id'); } public function tags(): BelongsToMany { return $this->belongsToMany(Tag::class, 'article_content_tag', 'content_id', 'tag_id'); } public function getCategoryNameAttribute(): string { return $this->category?->name ?? ''; } public function getTagNamesAttribute(): string { return $this->tags->pluck('name')->implode('、'); } public function getTagIdsAttribute(): array { return $this->tags->pluck('id')->map(static fn($id) => is_numeric($id) ? (int)$id : $id)->values()->all(); } }