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); } } })
image.png
Solution
You shouldn't $set an HtmlString. It probably should be formatted when output
Was this page helpful?