F
Filamentβ€’2y 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β€’2y 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β€’2y ago
or just new HtmlString('html') but also, i wouldnt render html like this. use css
Hurruwa
HurruwaOPβ€’2y 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β€’2y 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
HurruwaOPβ€’2y 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β€’2y 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
HurruwaOPβ€’2y 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β€’2y ago
preference
Hurruwa
HurruwaOPβ€’2y ago
Thanks
Want results from more Discord servers?
Add your server