Code Monkey home page Code Monkey logo

Comments (6)

dwightwatson avatar dwightwatson commented on June 11, 2024

I don’t understand the question, could you give some more context as to what you’re trying to achieve?

from validating.

maxdiable avatar maxdiable commented on June 11, 2024

hi, I would like to create a custom validation, for example I would like to check that a precise code is selected in an input field of the page, it's possible ?
br
Max

from validating.

dwightwatson avatar dwightwatson commented on June 11, 2024

Yes, just write a custom validation rule. The Laravel docs show you how to do this. Then just add your rule to the rules array on the model. This library just uses Laravel’s validation under the hood. Let me know if you have any issues with this.

from validating.

maxdiable avatar maxdiable commented on June 11, 2024

I tried to understand how to make a custom rule and associate it with the rules of your plugin, but I can not figure out how to do it, I will try to do other tests.
I created a custom rule for uppercase, and I was thinking of doing this: 'targa' => 'required | uppercase', but I think I'm wrong to do so
br
Max

from validating.

dwightwatson avatar dwightwatson commented on June 11, 2024

I'm not sure how more I can help apart from writing the code for you. Look at this page to see how to write custom validators for Laravel - using classes or extensions (you can't use the closure syntax with this package at this stage): https://laravel.com/docs/5.6/validation#custom-validation-rules

Then you just add those new rules to the $rules array on the model you want to validate. It would work just the same as if you were using Laravel's validator by itself.

from validating.

dwightwatson avatar dwightwatson commented on June 11, 2024

Actually it's possible that only the validator extensions work at the moment (not classes or closure syntax: #200).

from validating.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.