allowsDuplicates = $condition; return $this; } public function modelLabel(string | Closure | null $label): static { $this->modelLabel = $label; return $this; } public function pluralModelLabel(string | Closure | null $label): static { $this->pluralModelLabel = $label; return $this; } public function recordTitle(string | Closure | null $title): static { $this->recordTitle = $title; return $this; } public function recordTitleAttribute(string | Closure | null $attribute): static { $this->recordTitleAttribute = $attribute; return $this; } public function getRecords(): Collection | Paginator | CursorPaginator { return $this->getLivewire()->getTableRecords(); } public function getRecordKey(Model $record): string { return $this->getLivewire()->getTableRecordKey($record); } public function getModel(): string { return $this->getQuery()->getModel()::class; } public function allowsDuplicates(): bool { return (bool) $this->evaluate($this->allowsDuplicates); } public function getModelLabel(): string { return $this->evaluate($this->modelLabel) ?? get_model_label($this->getModel()); } public function getPluralModelLabel(): string { $label = $this->evaluate($this->pluralModelLabel); if (filled($label)) { return $label; } if (locale_has_pluralization()) { return Str::plural($this->getModelLabel()); } return $this->getModelLabel(); } public function getRecordTitle(Model $record): string { $title = $this->evaluate( $this->recordTitle, namedInjections: [ 'record' => $record, ], typedInjections: [ Model::class => $record, $record::class => $record, ], ); if (filled($titleAttribute = $this->getRecordTitleAttribute())) { $title ??= $record->getAttributeValue($titleAttribute); } $title ??= $this->getModelLabel(); if ($title instanceof HasLabel) { return $title->getLabel(); } if ($title instanceof BackedEnum) { return $title->value; } return $title; } public function hasCustomRecordTitle(): bool { return $this->recordTitle !== null; } public function getRecordTitleAttribute(): ?string { return $this->evaluate($this->recordTitleAttribute); } }