I have three form and I want to validate them within one request file.How to check the form identity within the rules method.I'm confused.I wrote this but It didn't work.here is my code
//rules method
public function rules()
{
switch ($this->check())
{
case 'personal':
return ['fanme'=>'required'];
break;
case 'career':
return ['career'=>'required'];
break;
case 'summary':
return ['summary_info'=>'required'];
break;
default:
return [];
break;
}
}
//my own method
public function check()
{
return $this->input('form_identity');
}
//form field
<input type="hidden" value="personal"
class="form-control required"
name="form_identity"/>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire