Git Product home page Git Product logo

Comments (4)

deiucanta avatar deiucanta commented on August 25, 2024

@vladflip I just released an alpha version. Please check it out.

Someone raised the same issue on Twitter: https://twitter.com/themsaid/status/1031449131879985152

The basic idea is that the model should be consistent regardless the role of the user, the action being taken (the title shouldn't be longer than 100 characters, the price should be at least 0 and numeric, the slug should match a regex rule). Can you think of some edge cases where this is not true?

We can split the validation rules in two groups

  1. Model rules (these are for the fields that get stored in the database)
  2. Controller rules (these are mostly for the user interface, are not stored in the database; if you have a SPA, you don't need to send them to the server)

For a registration form

  1. Model rules (name, email, password)
  2. Controller rules (terms & condition checkbox is checked, password confirmation field is same with password)

Of course, if you want to send the "terms" checkbox value to the server, you can, but I'm just trying to make my point.

from laravel-smart.

robsontenorio avatar robsontenorio commented on August 25, 2024

I think roles are out from escope this package.

from laravel-smart.

deiucanta avatar deiucanta commented on August 25, 2024

You're right @robsontenorio. User roles are out of the scope of this package but validation rules are right at the core. The questions is this: can user roles change validation rules?

from laravel-smart.

deiucanta avatar deiucanta commented on August 25, 2024

I will close this until someone provides a real scenario where this is required.

from laravel-smart.

Related Issues (19)

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.