'integer', 'sort' => 'integer', ]; public function category(): BelongsTo { return $this->belongsTo(Category::class, 'category_id'); } public function scopePublished($query) { return $query->where('status', 'published')->orderBy('sort')->orderBy('name'); } public function seoTitle(): string { // 仅返回实体名;品牌后缀由视图统一以 ' - ' . $siteName 追加(products/show.blade.php:4), // 避免 Product::seoTitle() 与视图双重拼接导致标题品牌重复(审计 SEO-02)。 return $this->seo_title ?: $this->name; } public function seoDescription(): string { return $this->seo_description ?: ($this->summary ?: $this->name); } }