子画面のパスワードリセットをトランザクション化にしました
このコミットが含まれているのは:
コミット
8df5aca418
|
@ -276,15 +276,27 @@ class ChildrenController extends Controller {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// DBに入る又は変えります。
|
// DBに入る又は変えります。
|
||||||
TelActivation::where('child_id', $result->id)->delete();
|
DB::beginTransaction();
|
||||||
TelActivation::create($create);
|
|
||||||
|
$telact = TelActivation::where('child_id', $result->id);
|
||||||
|
$telac2 = new TelActivation;
|
||||||
|
|
||||||
|
if (null !== ($telact->first())) {
|
||||||
|
$telact->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
$telac2->fill($create);
|
||||||
|
$telac2->push();
|
||||||
|
|
||||||
// SMSを送ります。
|
// SMSを送ります。
|
||||||
$message = view('sms.children.password', ['token' => $token]);
|
$message = view('sms.children.password', ['token' => $token]);
|
||||||
\Notification::route('nexmo', '81'.substr($r->tel, 1))->notify(new SmsNotification($message));
|
\Notification::route('nexmo', '81'.substr($r->tel, 1))->notify(new SmsNotification($message));
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
// 失敗
|
// 失敗
|
||||||
Log::critical($e->getMessage());
|
Log::critical($e->getMessage());
|
||||||
|
DB::rollback();
|
||||||
return ['status_code' => 400, 'error_messages' => '電話番号が未登録です。入力した情報を確認してください。'];
|
return ['status_code' => 400, 'error_messages' => '電話番号が未登録です。入力した情報を確認してください。'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,6 +519,7 @@ class ChildrenController extends Controller {
|
||||||
// 失敗
|
// 失敗
|
||||||
Log::critical($e->getMessage());
|
Log::critical($e->getMessage());
|
||||||
Storage::disk('private')->delete($filename);
|
Storage::disk('private')->delete($filename);
|
||||||
|
DB::rollback();
|
||||||
return ['status_code' => 400, 'error_messages' => ['画像の更新に失敗しました。']];
|
return ['status_code' => 400, 'error_messages' => ['画像の更新に失敗しました。']];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
新しいイシューから参照