子のパスワードリセット

このコミットが含まれているのは:
守矢諏訪子 2022-02-06 16:11:38 +09:00
コミット c552b78e43
1個のファイルの変更13行の追加5行の削除

ファイルの表示

@ -613,15 +613,23 @@ class ChildrenController extends Controller {
return ['status_code' => 422, 'error_messages' => $validate->errors()];
}
$update = [
'password' => Hash::make($r->password),
];
try {
Child::where('id', (int)$child_id)->update($update);
DB::beginTransaction();
$child = Child::find((int)$child_id);
$child->password = Hash::make($r->password);
$child->save();
if (isset($r->token)) {
$telact = TelActivation::where('token', $r->token);
$telact->delete();
}
DB::commit();
} catch (\Throwable $e) {
// 失敗
Log::critical($e->getMessage());
DB::rollback();
return ['status_code' => 400, 'error_messages' => ['パスワードの更新に失敗しました。']];
}