What is the better way to create a model with has many relationship?
For example:
I have two models:
- Client (id, name, ...)
- Contact (id, type, value, description)
A client has many Contacts.
Example of create client view: http://laravel.io/bin/mGXEE
Problems:
- how to deal with validations?
- if validation fails, going back and fill in the contact with the respective errors?
With
php artisan make:request
you can make a request file that will validate your information. Take a look at the documentation: https://laravel.com/docs/5.1/validationExample:
View: