© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
11 replies
Alnuaimi

Why HtmlString not work in filamentphp

    ->afterStateUpdated(function ($state, callable $set, callable $get) {
                self::updateRiskRates($state, $set, $get);
                $value = RiskManagementRiskCalculationValue::whereIn('selectedTab', ['addition', 'multiplication'])->first();
                if ($value) {
                    if ($value->selectedTab === 'addition') {
                        $inherentRiskRate = $get('likelihood') + $get('impact');
                        $htmlContent = new HtmlString('<div>Addition Calculation</div>') . $get('likelihood') . ' + ' . $get('impact') . ' = ' . $inherentRiskRate;
                        $set('culation', $htmlContent);
                    } elseif ($value->selectedTab === 'multiplication') {
                        $inherentRiskRate = $get('likelihood') * $get('impact');
                        $htmlContent = new HtmlString('<div>Multiplication Calculation</div>') . $get('likelihood') . ' * ' . $get('impact') . ' = ' . $inherentRiskRate;
                        $set('culation', $htmlContent);
                    }
                }
            })
    ->afterStateUpdated(function ($state, callable $set, callable $get) {
                self::updateRiskRates($state, $set, $get);
                $value = RiskManagementRiskCalculationValue::whereIn('selectedTab', ['addition', 'multiplication'])->first();
                if ($value) {
                    if ($value->selectedTab === 'addition') {
                        $inherentRiskRate = $get('likelihood') + $get('impact');
                        $htmlContent = new HtmlString('<div>Addition Calculation</div>') . $get('likelihood') . ' + ' . $get('impact') . ' = ' . $inherentRiskRate;
                        $set('culation', $htmlContent);
                    } elseif ($value->selectedTab === 'multiplication') {
                        $inherentRiskRate = $get('likelihood') * $get('impact');
                        $htmlContent = new HtmlString('<div>Multiplication Calculation</div>') . $get('likelihood') . ' * ' . $get('impact') . ' = ' . $inherentRiskRate;
                        $set('culation', $htmlContent);
                    }
                }
            })
image.png
Solution
You shouldn't
$set
$set
an HtmlString. It probably should be formatted when output
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Filamentphp page not work
FilamentFFilament / ❓┊help
13mo ago
PHP inside of HtmlString?
FilamentFFilament / ❓┊help
15mo ago
Would sqlite work well with filamentphp?
FilamentFFilament / ❓┊help
2y ago
filamentphp
FilamentFFilament / ❓┊help
2y ago