Skip to content

Commit

Permalink
Add customFilters example (#52)
Browse files Browse the repository at this point in the history
* Add customFilters example

* Update composer.json

* Update composer.json

* Update composer.json

Co-authored-by: francoism90 <f.menning@pm.me>
Co-authored-by: William <william@waavi.com>
  • Loading branch information
3 people authored Mar 9, 2020
1 parent c7e718f commit 5fce6fe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ You may also Sanitize input in your own FormRequests by using the SanitizesInput
return [
'name' => 'trim|capitalize',
'email' => 'trim',
'text' => 'remove_strings:Curse,Words,Galore',
];
}

public function customFilters()
{
return [
'remove_strings' => RemoveStringsFilter::class,
];
}

Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "waavi/sanitizer",
"description": "Data sanitizer and Laravel 5 form requests with input sanitation.",
"description": "Data sanitizer and Laravel 7 form requests with input sanitation.",
"keywords": ["laravel", "sanitation", "input sanitation", "input sanitizer", "input", "transform input", "input filter"],
"license": "MIT",
"authors": [{
Expand Down Expand Up @@ -33,6 +33,9 @@
}
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"scripts": {
"test": "vendor/bin/phpunit"
Expand Down
4 changes: 2 additions & 2 deletions src/Laravel/SanitizesInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function addCustomFilters()
/**
* Filters to be applied to the input.
*
* @return void
* @return array
*/
public function filters()
{
Expand All @@ -68,7 +68,7 @@ public function filters()
/**
* Custom Filters to be applied to the input.
*
* @return void
* @return array
*/
public function customFilters()
{
Expand Down

0 comments on commit 5fce6fe

Please sign in to comment.