From 201f855dc2925ab8f33c1aef7b59b0306ff13bc4 Mon Sep 17 00:00:00 2001 From: Cristian Tabacitu Date: Sat, 9 Oct 2021 10:07:29 +0300 Subject: [PATCH] Add custom casts to refreshed docs --- README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b509713..93be1b5 100755 --- a/README.md +++ b/README.md @@ -54,7 +54,9 @@ Check out [HTMLPurifier for Laravel 4](https://github.com/mewebstudio/Purifier/t ## Usage -default + +Use these methods inside your requests or middleware, wherever you need the HTML cleaned up: + ```php clean(Input::get('inputname')); ``` @@ -85,6 +87,28 @@ Purifier::clean('This is my H1 title', 'titles', function (HTMLPurifier_Config $ }); ``` +Alternatively, in Laravel 7+, if you're looking to clean your HTML inside your Eloquent models, you can use our custom casts: + +```php + CleanHtml::class, // cleans both when getting and setting the value + 'description' => CleanHtmlInput::class, // cleans when setting the value + 'history' => CleanHtmlOutput::class, // cleans when getting the value + ]; +} +``` + ## Configuration To use your own settings, publish config.