alexeymezenin / laravel-best-practices

Laravel best practices
11.43k stars 2.38k forks source link

Use Array Instead Of Delimiter In Validation Rules #104

Closed amiyoghoshstar closed 3 years ago

amiyoghoshstar commented 3 years ago

It is best practice to add validation rules in an array instead of using delimiters. We can use custom validation class

amiyoghoshstar commented 3 years ago

@alexeymezenin why dont you merging PRs?

Konafets commented 3 years ago

I doubt this is considered as best practice. It is just an alternative.

pietrushek commented 3 years ago

I think that this is only more elegant method... maybe sometimes more handy

Tpojka commented 3 years ago

@alexeymezenin why dont you merging PRs?

PR should be rewritten following syntax and other industry standards of PSRs. Like space after comma or one space after equal arrow sign between key value pair in array.

Aside, I agree array format is more maintainable and biggest different (and also why should be considered as better way) is that using array format rules, it is available to include custom created rule classes.

alexeymezenin commented 3 years ago

I doubt this is considered as best practice. It is just an alternative.

I agree with that.