D
D
dk-web2016-04-25 14:05:35
MySQL
dk-web, 2016-04-25 14:05:35

How to properly organize the recording of multiple characteristics of an object?

Again there were doubts about the optimality of my approach.
I am using Laravel 5.2 and MySQL.
There is a registry of objects .. id, description ..
But let's say each object can have several of them. Let's say it's phone numbers.
OK. Banal phone book. There is a full name and an indefinite set of phones.
I create two tables - fio, phones connected by id.
I can get all the records and attach links with with ... but how is the initial iteration of a record in the database carried out?
The form is outwardly uniform... and the button to add to the database should be one...
Do I understand correctly that programmatically it should be several different forms with different controllers?
Where to peek?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
D', 2016-04-25
@dk-web

You don't need many forms.
It is enough to call in the controller: $user->phones()->create($phone) and that's it.
Where:
- $user - actual user from fio table
- $phone - phone

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question