F
Filamentβ€’3mo 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β€’3mo ago
Maybe because you are strict checking? Also, I think you should use formatStateUsing
Dennis Koch
Dennis Kochβ€’3mo ago
Nope. getStateUsing() is correct here, because null wouldn't be passed to formatStateUsing
JJSanders
JJSandersβ€’3mo ago
So any idea why it wouldnt work?
LeandroFerreira
LeandroFerreiraβ€’3mo ago
Isn't 'Nee' displayed?
Solution
JJSanders
JJSandersβ€’3mo ago
It seems to work now. Don't know why it wasn't working before
Dennis Koch
Dennis Kochβ€’3mo ago
Nee πŸ˜…
Want results from more Discord servers?
Add your server
More Posts