This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi all
I've got some funky logic in my plugin which means I need to write a custom validation rule for my url field, as it could have different values depending on other fields. I've read over the Laravel documentation, and I can't figure out where to create the custom rule in the model so that it runs. Has anybody does this and can give me a pointer on how to set it up please?
I've read this post on emails which seems to indicate one way of doing it, but I'd rather simply add the custom validator name to the existing rules array and have it all work automagically.
Thanks for any pointers you can give :)
Thanks @Shahiem, but I did say I've read that. I'm after specific pointers on how to implement that in an October Model, which is where the rules are. I'm new to Laravel and October so I'm missing something obvious but I don't know what.
There's no reason for custom validation rules to work in an other way than in the Laravel way. Simply add you Validator::extend
before your class in your controller, or create specific file with your rules and include it in your controller model, probably with the use
instruction.
1-4 of 4