Comments (5)
This is quite interesting, specially with the case of conditionally changing parameters.
Currently this is very unreadable:
'email' => 'email|unique:users,email'.($item ? ",$item->id" : ''),
Having an way of adding/updating rules parameters can make the validation code more readable. I'm planning to propose some changes to the validator in 5.3 and I believe adding this option is very useful.
from ideas.
Not sure if you already know, but passing rules for a field as an array instead of separating them by pipes is already possible.
So, to get what you want, a simple helper function that returns an array of rule parameters into a stringified rule would be enough.
from ideas.
passing rules for a field as an array instead of separating them by pipes is already possible
This part isn't really explained in the docs, except for a small mention in the regex rule (because it's the only workaround for using pipes in regexes).
from ideas.
I am aware that it is possible to define rules as an array, but to my knowledge it is not possible to define their parameters in the same manner -- I mentioned in my OP that a helper could be used for that, sure -- however it is tedious and cumbersome, and it does not address or resolve points 2 or 3, and point 4 without some manually work in between the final rules being returned
from ideas.
I think this was essentially solved with introduced of fluent syntax for rules.
from ideas.
Related Issues (20)
- [Proposal] Easy way to cancel notifications at time of sending
- Rendering Blade Components Outside of Views HOT 1
- Assert that a component has rendered on a page
- Service Container | Contextual Binding of the Methods
- [REQUEST] Enable flush method from dynamoDB cache HOT 3
- [Feature] Enable flush method from dynamoDB
- [Proposal] Support AOP with php8 Attribute
- laravel join select max of joined column
- Ability to get event name which fires in Eloquent booted method HOT 1
- Make `php artisan migrate:reset` work with *-schema.dump
- Size File Validation only deals with Kilobytes
- Suggesting that ".env.testing" file be added to .gitignore HOT 2
- add native support for dev containers HOT 3
- [9.x] Rename firstOrNew() to firstOrMake()
- Set property to a config value via an Attribute HOT 1
- Add support to get more information on the job class
- Allow pausing batches
- afterCommit on Queueable Anonymous Event Listeners
- Upsert for related models
- Command option to run scheduler in a particular timezone
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 ideas.