所以我现在所拥有的: 一个CRUD应用程序:一个注册表和一个表格,以及一个Extraregistration表,我要在其中保存注册中的某些字段。 Extraregistration表具有一个registration_id。
RegistrationController
$registration->ris_firstname = $request->firstname;
$registration->ris_lastname= $request->lastname;
$registration->ris_email = $request->email;
html
<label>Firstname</label>
<input type="text" name="firstname" id="firstname" class="form-control" data-blocked="<>{}" value="{{ ($cache['firstname'] ?? old('firstname') ?? $registration->ris_firstname ?? '') }}" required>
<label>Lastname</label>
<input type="text" name="lastname" id="lastname" class="form-control" data-blocked="<>{}" value="{{ ($cache['lastname'] ?? old('lastname') ?? $registration->ris_lastname ?? '') }}" required>
<label>E-mail</label>
<input type="text" name="email" id="email" class="form-control" data-blocked="<>{}" value="{{ ($cache['email'] ?? old('email') ?? $registration->ris_email ?? '') }}" required>
ExtraregistrationController
$extraregistration->iea_price = $request->price;
$extraextraregistration->iea_registration_id = $registration_id;
html
<label>Price</label>
<input type="text" name="price" id="price" class="form-control" data-blocked="<>{}" value="{{ ($cache['price'] ?? old('price') ?? $extraregistration->iea_price ?? '') }}" required>
我想将名字和姓氏保存到Extraregistration表中,而不是在普通注册表中。 因此,当我添加注册时,名字和姓氏转到数据库中Extraregistration表中的registration_firstname字段中的extraregistration表中 预先感谢!