Is it possible to render Blade template directly inside Placeholder contents() function?
It's been bugging me for a long time I don't know if it is possible to render Blade template directly inside Placeholder contents() function? I don't want to create a new view file for it cause a have to swap between file I find it a bit cumbersome.
For example:
Forms\Components\Placeholder::make('remaining')
->content(function (?SavingAccount $record) {
return new HtmlString(<<<HTML
@if ($record->remaining > 0)
<div class="pt-1">{{ number_format($remaining) }}</div>
@endif
HTML
);
}),
I just can't find the right syntax to render @if and blade template correctly inside the functions. Is it possible to do so?
Thanks.
1 Reply
new HtmlString(Blade::render(<HTML>))