Hi all
I have two table in DB : companies
and shop
, both of them have name
fields .
And I want to add new Company and it's shops in one form. So in my form I have 2 kinds of model (company and shops).
For echo validation message in this form. I decleared $rules array in each model's class ( Company and Shop).
My problem is both of them have the same field called name
( which are company name and shop name).
When have both 2 object in one form, the error message which is returned from StoreController will have the same 'name' element in errors array. So, How can I separate Company name error and Shop name error to display error messages ?
You can use custom validation attributes to define how to convert any attribute to the string that you want to display in error message
'attributes' => array(
'name_company' => 'Company name',
'name_shop' => 'Shop name'
),
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community