F
Filamentβ€’15mo ago
Hurruwa

How to render HTML on $subheading

Im trying to render HTML to the subheading but cant find a way around this. this is the code i have so far:
protected function getSubheading(): string|Htmlable|null
{
return "<span class='text-sm text-gray-500'>".$this->record->pallet_no."</span>";
}
protected function getSubheading(): string|Htmlable|null
{
return "<span class='text-sm text-gray-500'>".$this->record->pallet_no."</span>";
}
and this is the result:
9 Replies
krekas
krekasβ€’15mo ago
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation β€” freeing you to create without sweating the small things.
Dan Harrin
Dan Harrinβ€’15mo ago
or just new HtmlString('html') but also, i wouldnt render html like this. use css
Hurruwa
Hurruwaβ€’15mo ago
Thanks in advance for the reply. You mean like in a custom subheading view or something like that?? since i dont want all subheading to look the same.
Dan Harrin
Dan Harrinβ€’15mo ago
im just not a fan of putting tailwind classes in php i would extract it to a different class maybe also i think all pages have a unique class so maybe you could target that
Hurruwa
Hurruwaβ€’15mo ago
Done, i extracted the header into a custom view... and do the change there... but now i can't show the actions... 😒
Dan Harrin
Dan Harrinβ€’15mo ago
yeah i wouldnt suggest that for that reason its fine just do the tailwind classes its no big deal, im just being picky
Hurruwa
Hurruwaβ€’15mo ago
Ok so tailwind clases it is πŸ˜‰ Thanks @danharrin One question... your opinion on adding css inside php its for a security reason or just personal preference? Thanks in advance πŸ˜‰
Dan Harrin
Dan Harrinβ€’15mo ago
preference
Hurruwa
Hurruwaβ€’15mo ago
Thanks