Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

gwa's avatar
Level 3

Laravel 5.4 auto convert empty text input to null?

I just stumbled across a recent change in Laravel since 5.4 I noticed that Input fields wich are empty or with just blanks got converted to null in the request object.

That leeds to the Problem that in ::create($request->all()); null values are not taken the database default value. Instead it causes an error if the field is not nullable.

Is there an easy solution out there? Or am I doing something wrong.

Best Max

0 likes
4 replies
gwa's avatar
Level 3

Thanks guys that helped a lot!

Please or to participate in this conversation.