'integer', 'is_deeplink_only' => 'boolean', ]; protected $appends = ['icon_url', 'deep_link']; public function getIconUrlAttribute(): ?string { return $this->icon ? asset('storage/' . $this->icon) : null; } public function getDeepLinkAttribute(): ?string { $canonical = config('deeplinks.category_pattern'); if ($canonical) { return rtrim(str_replace('{id}', $this->id, $canonical), '/'); } return url('/category/' . $this->id); } public function questions() { return $this->hasMany(Question::class); } public function subcategories() { return $this->hasMany(SubCategory::class); } public function media() { return $this->belongsToMany(Media::class, 'category_media'); } }