Support the ongoing development of Laravel.io →
Security Validation
Last updated 2 years ago.
0

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.

Thanks.

0

@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

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.