Вот мой код:
$user = new \App\User;
$user -> role = 'anggota';
$user -> name = $request -> nama;
$user -> email = $request -> email;
$user -> password = bcrypt('rahasia');
$user -> remember_token = Str::random(60);
$user -> save();
//insert tabel anggota
$request ->request->add(['user_id' => $user-> id]);
$anggota = new angota([
'nik' => $request -> input ('nik'),
'nama' => $request -> input ('nama'),
'tempat_lahir' => $request -> input ('tempat_lahir'),
'tgl_lahir' => $request -> input ('tgl_lahir'),
'jenis_kelamin' => $request -> input ('jenis_kelamin'),
'pekerjaan' => $request -> input ('pekerjaan'),
'agama' => $request -> input ('agama'),
'gol_darah' => $request -> input ('gol_darah'),
'alamat' => $request -> input ('alamat'),
'email' => $request -> input ('email'),
'no_hp' => $request -> input ('no_hp')
]);
Я пытаюсь получить идентификатор пользователя таблицы в таблицу anggota, но получаю следующую ошибку:
"SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value"