I'm trying to assign the many data in one form, but it gives me this error although there is data in id_personalia
.
Here is the error message:
SQLSTATE[HY000]: General error: 1364 Field 'id_personalia' doesn't have a default value (SQL: insert into `tbl_personalia_perusahaan` (`id_profil_penyedia`, `nm_personal`, `tgl_personal`, `pendidikan_personal`, `jbtn_personal`, `pengalaman_personal`, `keahlian_personal`, `sertif_personal`, `path_personal`) values (9, Bambang, 24 ns, sd, sekretaris, 3, ada, ada, archive_gambar/138/pendaftaran_perusahaan/138-personal-1.pdf))
My controller:
$nop = 1;
foreach ($request->nm_personal as $person=>$p) {
$nmpersonal = $sesi . '-personal-' . $nop . '.' . $request->img_personal[$person]->getClientOriginalExtension();
$path_personal = 'archive_gambar/' . $sesi . '/pendaftaran_perusahaan/' . $nmpersonal;
$request->img_personal[$person]->move($tujuan_upload, $nmpersonal);
$data7 = array(
'id_profil_penyedia' => $id_perus,
'nm_personal' => $request->nm_personal[$person],
'tgl_personal' => $request->tgl_personal[$person],
'pendidikan_personal' => $request->pendidikan_personal[$person],
'jbtn_personal' => $request->jbtn_personal[$person],
'pengalaman_personal' => $request->pengalaman_personal[$person],
'keahlian_personal' => $request->keahlian_personal[$person],
'sertif_personal' => $request->sertif_personal[$person],
'path_personal' => $path_personal
);
$nop++;
ModelPersonalia::insert($data7);
}
id_personalia
field in your$data7
array. Try adding it there. – Qumberid_personalia
field, otherwise you should set a value forid_personalia
field in$data7
array. – Tusharid_personalia
field nullable Or Make a default value for the field. – Jithesh Jose