F
Filamentβ€’8mo ago
JJSanders

TextEntry when value is null

TextEntry::make('strap')
->columnSpanFull()
->getStateUsing(function (Product $record) {
ray($record);
return $record->strap === 1 ? 'Ja' : 'Nee';
})
TextEntry::make('strap')
->columnSpanFull()
->getStateUsing(function (Product $record) {
ray($record);
return $record->strap === 1 ? 'Ja' : 'Nee';
})
Why doesn't this work when the value of strap is null?
Solution:
It seems to work now. Don't know why it wasn't working before
Jump to solution
6 Replies
krekas
krekasβ€’8mo ago
Maybe because you are strict checking? Also, I think you should use formatStateUsing
Dennis Koch
Dennis Kochβ€’8mo ago
Nope. getStateUsing() is correct here, because null wouldn't be passed to formatStateUsing
JJSanders
JJSandersOPβ€’8mo ago
So any idea why it wouldnt work?
LeandroFerreira
LeandroFerreiraβ€’8mo ago
Isn't 'Nee' displayed?
Solution
JJSanders
JJSandersβ€’8mo ago
It seems to work now. Don't know why it wasn't working before
Dennis Koch
Dennis Kochβ€’8mo ago
Nee πŸ˜…
Want results from more Discord servers?
Add your server