Support the ongoing development of →
Security Validation
Last updated 1 year ago.

Hi Vidi,

You're on the right track.. This is not the answer you're looking for but it might help in your journey to building something amazing...I THINK...

The validator is to make sure what client is entering into our application is valid if not send response back to user to correct it, not to clean it up for them. So my suggestion to you is validate the field for **integer" (Yes Laravel has that that rule already) if client enter something other than integer tell them to enter an integer.

Sometimes for whatever reason something didn't work and you ended getting unwanted data, or perhaps do just don't trust the validation to do its job, or that is where Laravel's mutators comes in handy. You can cleanup or do whatever you want with the data before saving it to the database. You can actually call the Regex within the mutator.

I hope that helps.



@sp01010011 , thank you very much, yes i will try with mutator, and will post it again here, after some research and implementation.

many thanks to you my friend


Sign in to participate in this thread!

Full Stack Europe

Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 - All rights reserved.