Trim Text Inputs

How do I trim all TextInputs before saving to the database? I would've thought this would have been automatic because of the Laravel TrimStrings middleware but I can still added whitespace characters before and after the string and they still save.
4 Replies
Azad Furkan ŞAKAR
Maybe you can use TextInput::configureUsing() method in panel provider boot method.
Dennis Koch
Dennis Koch2d ago
I would've thought this would have been automatic because of the Laravel TrimStrings middleware but I can still added whitespace characters before and after the string and they still save.
Strings aren't trimmed in Livewire because it would break the "live" mode
frame
frame23h ago
Time to add some test cases to make sure everythings trimmed. Whats the easiest way to add trim on a TextEntry? 👀

Did you find this page helpful?