Welcome Guest, Not a member yet? Register   Sign In
How to set validation rules for all fields.
#1

Hello,

I have more than 20+ fields where the values are required. so manually adding one by one to the property like :


PHP Code:
  protected $validationRules = [

        'first_name' => ['required'],
        'last_name' => ['required'],

    ]; 


Is there any other alternative way to do this for all ?
Reply
#2

There is no other way than to write code that manipulates array ($this->validationRules) in a usual way.

But I recommend you write 'required' manually, because it is easy to understand the code.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB