I have a helper class and I use strip_tags:
public static function fixValue($rvalue)
{
$rvalue = empty($rvalue) && !is_numeric($rvalue) ? NULL : trim(strip_tags($rvalue));
return $rvalue;
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
If I use a class created with 'php artisan make:request' to record my validation rules, am I able to only have one 'request class' in my project? If not, I can't find the right idea of how to make multiple request classes to handle my various resource controllers. How is this usually done?
Now the part of my question that relates to sanitizing inputs (with filter_var):
I saw a sample where someone added a sanitize method as a separate method in the request class and then validated the sanitized data with the 'rules' after it was sanitized. Is this a preferred method in Laravel?
Thank you.
Please or to participate in this conversation.