In need some suggestion for an elegant way to solve this situation:
1st - I need to use Form::model because i want to populate the inputs with the model data; and for this to work, if im not wrong, i need the inputs names to match the model names, ie, for example if i have a 'Company' table and inside of it i have a field called 'email', then in the Form i must have an input named 'email' so that the Form::model can work properly.
2nd - Now, imagine i have another table called 'User' which will have also an 'email' field. When i use custom messages for both forms, i have a problem, because both are called 'email' and i have different msgs that i want to use for each of them.
Ex:
Form::model($company, ...) Form::text('email', ...)
when i validade this form it will retrieve a custom msg from the validator file for email:
'custom' => array( 'email' => array('required' => 'Company email required!'), );
Form::model($user, ...) Form::text('email', ...)
when i validade this form it will retrieve a custom msg from the validator file for email:
'custom' => array( 'email' => array('required' => 'User email required!'), );
So, how can work around this? If the input names must match the model ones, how can i differentiate them in the validator file? Hope i was clear enough :P
Thanks
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community