Asked by: Adriani Umar
in laravel i want to insert into two tables the data from one form.
my forms are:
<input type="text" name="name"class="form-control">
<input type="text" name="age"class="form-control">
<input type="text" name="sex"class="form-control">
<input type="text" name="location"class="form-control">
i want to insert the name
, age
, and sex
to table details
. and input location
to table locations
location
model belongsTo
detail
model.
how to insert them at the same time? and how to automatically match the id
of detail
with detail_id
of location
?
i have search but too difficult to follow. i wish there's an easy way to follow.
No comments:
Post a Comment