Laravel 5.4: Sanitize Request Input by using Sanitizing Middleware

Sanitize Request in laravel 5.4
Sanitize Request in laravel 5.4

Laravel 5 contains a couples of middlewares.In Laravel 5.4 two new middlewares are introduced for Sanitizing inputs in requests.They are

  • TrimStrings
  • ConvertEmptyStringsToNull
  • .
    Both middlewares are very usefull in order to sanitize requests.

    TrimStrings Middleware

    This middleware is used to remove all white spaces of inputs of request.

    ConvertEmptyStringsToNull:

    This middleware convert all blanks requests inputs to null.

Leave a Reply

Your email address will not be published. Required fields are marked *