Skip to content

Beautifying validation rules in Laravel #1766

@sashabeton

Description

@sashabeton

It would be great to create transformer from inline validation rules to array definition.

F.e.

'required|exists:' . Model::class . ',attribute|string'

can be transformed to

[  
  'required',  
  'exists:' . Model::class . ',attribute',  
  'string',  
]  

which is more beautiful, readable and editable.

Furthermore,

'exists:' . Model::class . ',attribute'

can be transformed to

\Illuminate\Validation\Rule::exists(Model::class, 'attribute')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions