protected function setUp(): void
{
parent::setUp();
$this->beforeStateDehydrated(function(FilamentJsonColumn $component, $state) {
if (is_string($state)) {
$decodedState = json_decode($state, true);
if (json_last_error() !== JSON_ERROR_NONE) {
Notification::make()
->title($component->getErrorMessage() === '' ? 'Fix the invalid JSON values' : $component->getErrorMessage())
->danger()
->send();
throw ValidationException::withMessages([]);
}
$component->state($decodedState);
}
});
}
protected function setUp(): void
{
parent::setUp();
$this->beforeStateDehydrated(function(FilamentJsonColumn $component, $state) {
if (is_string($state)) {
$decodedState = json_decode($state, true);
if (json_last_error() !== JSON_ERROR_NONE) {
Notification::make()
->title($component->getErrorMessage() === '' ? 'Fix the invalid JSON values' : $component->getErrorMessage())
->danger()
->send();
throw ValidationException::withMessages([]);
}
$component->state($decodedState);
}
});
}