PHP code example of arondeparon / laravel-request-sanitizer
1. Go to this page and download the library: Download arondeparon/laravel-request-sanitizer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
arondeparon / laravel-request-sanitizer example snippets
class StoreUsersRequest extends FormRequest
{
use SanitizesInputs;
protected $sanitizers = [
// Apply to all email fields in the users array
'users.*.email' => [
Lowercase::class,
TrimDuplicateSpaces::class
],
// Apply to all name fields in the users array
'users.*.name' => [
Capitalize::class
],
// Multiple wildcards for deeply nested structures
'departments.*.employees.*.email' => [
Lowercase::class
]
];
}