Comments (4)
@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
- Model rules (these are for the fields that get stored in the database)
- 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
- Model rules (name, email, password)
- 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.
I think roles are out from escope this package.
from laravel-smart.
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.
I will close this until someone provides a real scenario where this is required.
from laravel-smart.
Related Issues (19)
- Idea: lookup models HOT 14
- Converting existing model to Smart model HOT 5
- Error: guarded() not working as expected
- Support for User model HOT 4
- What if relations were defined as fields? HOT 7
- Idea: label() HOT 2
- Cache `$model->fields()` HOT 2
- Support virtual fields for mysql HOT 4
- Erro: ID validation
- Support field comment
- Idea: timestamps() HOT 1
- [Question] Still active? HOT 2
- not install in laravel 9
- Error: change to nullable() HOT 1
- Idea: foreign() / references() HOT 6
- Improvement: Throw an exception when type is not defined
- Idea: create new fresh smart migration
- Error: Class 'Deiucanta\Smart\Rule' not found
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-smart.