D
D
dnsite2020-04-28 13:19:06
Laravel
dnsite, 2020-04-28 13:19:06

How to send results from one form to two tables, while the id of the first one should be written to the pid of the other?

How to send results from one form to two tables, while the id of the first one should be recorded in the entity_id of the other? 5ea801f653525608466691.png.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wscms, 2020-04-28
@wscms

Judging by the tag, this is Lara.
Ajax sends data to the backend to some kind of controller. Suppose public function manageForm(Request $request)
Accordingly, you have three models - Entity, EntityTranslate and Language
In the controller, something like
$entity = Entity::create(['A' => $request->get(' A')]);
$entityTranslate = EntityTranslate:: create(['EntityId' => $entity->id]);
The basics

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question