gwa
2 years ago
103
4
Laravel

Laravel 5.4 auto convert empty text input to null?

Posted 2 years ago by gwa

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

Please sign in or create an account to participate in this conversation.