$userId = $id ?: auth()->user()->id;
$user = User::with('profile')->findOrFail($userId);
$request->validate([
'name' => ['required', 'string'],
'nip' => ['required', 'string'],
'jk' => ['required', 'string'],
'email' => ['required', 'string'],
'nuptk' => ['required','string'],
'no_seri_karpeg' => ['required','string'],
'pangkat' => ['required','string'],
'golongan' => ['required','string'],
'ruang' => ['required','string'],
'tmt_pangkat' => ['required','string'],
'jabatan' => ['required','string'],
'tmt_jabatan' => ['required','string'],
'tanggal_lahir' => ['required','string'],
'tempat_lahir' => ['required','string'],
'pendidikan' => ['required','string'],
'pendidikan_jurusan' => ['required','string'],
'jabatan_fungsional' => ['required','string'],
'tmt_jabatan_fungsional' => ['required','string'],
'masa_kerja_lama' => ['required','string'],
'masa_kerja_baru' => ['required','string'],
'jenis_guru' => ['required','string'],
'mengajar' => ['required','string'],
'unit_kerja' => ['required','string'],
'gaji_lama' => ['required','string'],
'gaji_baru' => ['required','string'],
'jumlah_ak_lama' => ['required','string'],
'jumlah_ak_baru' => ['required','string'],
'alamat' => ['required','string'],
'provinsi' => ['required','string'],
'kota' => ['required','string'],
'kelurahan' => ['required','string'],
'kecamatan' => ['required','string'],
'kode_pos' => ['required','string'],
]);
$user = User::update($request->all());
$user->profile = Profile::update($request->all());
$user->save();
return route('profile')->with('success','Updated');
или
$userId = $id ?: auth()->user()->id;
$user = User::with('profile')->findOrFail($userId);
$rules = array_map(function () {
return ['required'];
}, $request->all());
$request->validate($rules);
$user = User::update($request->all());
$user->profile = Profile::update($request->all());
$user->save();
return route('profile')->with('success','Updated');
Я обновил контроллер, но не обновил таблицу, но ошибка исчезла