|string $resourceRelated * @param string $relation * @param bool|null $shouldUseName * @return static */ public function urlToRelated(string $resourceRelated, string $relation, ?bool $shouldUseName = false): static { return $this ->weight(FontWeight::SemiBold) ->html() ->url(function (BaseModel|Model $record) use ($resourceRelated, $relation, $shouldUseName) { if (!empty($relation)) { foreach (explode('.', $relation) as $element) { $record = Arr::get($record, $element); if ($record === null) return null; } } $this->formatStateUsing(function ($state) use ($shouldUseName, $record) { $name = $shouldUseName ? $record->getName() : $state; return "

{$name}

"; }); return (new $resourceRelated)::getUrl('view', ['record' => $record]); }); } /** * Make the entry copyable. * * @param bool $condition * @return static */ public function copyableWithMessage(bool $condition = true): static { return $this ->copyable($condition) ->copyMessage(__('filament.actions.base.copied')) ->icon('heroicon-o-clipboard'); } }