'boolean', 'featured' => 'boolean', 'cards_count' => 'integer', ]; public function user(): BelongsTo { return $this->belongsTo(User::class); } public function items(): HasMany { return $this->hasMany(NovaCardCollectionItem::class, 'collection_id'); } public function cards(): BelongsToMany { return $this->belongsToMany(NovaCard::class, 'nova_card_collection_items', 'collection_id', 'card_id') ->withPivot(['note', 'sort_order']) ->withTimestamps(); } public function isPubliclyVisible(): bool { return $this->official || $this->visibility === self::VISIBILITY_PUBLIC; } public function publicUrl(): ?string { if (! $this->exists || ! Route::has('cards.collections.show')) { return null; } return route('cards.collections.show', [ 'slug' => $this->slug, 'id' => $this->id, ]); } }