Support the ongoing development of Laravel.io →
Database Eloquent Packages
Last updated 2 years ago.
0

Looks nice. When I did something similar (with no intention to make reusable though) I found I sometimes needed 4 validation rule sets (input on create/update and database data on create/update). A simplified example could be User and Password. Input data are 'login', 'password' and 'password confirmation' with rules for passwords however for database data you have got 'login' and 'password_hash'. Same for update.

Last updated 9 years ago.
0

@neomerx Things like password confirmation are applicable basically only during http request, when you're submitting a form, so there's no problem to do something like this:

// Form Request
public function rules()
{
   return array_merge(
        User::getCreateRules(), 
        ['password' => 'confirmed']
   );
}
0

Sure. However when you have all your rules in models and then you have to have some of them outside (e.g. in forms) you start thinking what you should do with it. So did I ;) Anyway you did a big job on coverage and fixing pesky scrutinizer issues :) Keep going, man

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.