Laravel 5 Validation Trim

后端 未结 8 920
梦谈多话
梦谈多话 2020-12-18 05:23

I am a beginner in Laravel 5.

How can I remove whitespaces in validator?? i have read the documentation but there is no validator for trim(remove whitespaces).

8条回答
  •  离开以前
    2020-12-18 05:58

    Due to the documention laravel HTTP Request by default laravel trim all the requests data.


    and Trim the request in validation part is so dirty job. You could manage this feature like trim or convert empty string to null with the middleware

    because middleware execute before the validation and you could have clean data in validation

提交回复
热议问题