discard elapsed timeフラグの立ったチェックインの表示対応

This commit is contained in:
shibafu
2020-11-08 23:07:51 +09:00
parent 855011c624
commit 3825228344
5 changed files with 34 additions and 17 deletions

View File

@@ -121,21 +121,7 @@ class EjaculationController extends Controller
->firstOrFail();
$user = User::findOrFail($ejaculation->user_id);
// 1つ前のチェックインからの経過時間を求める
$previousEjaculation = Ejaculation::select('ejaculated_date')
->where('user_id', $ejaculation->user_id)
->where('ejaculated_date', '<', $ejaculation->ejaculated_date)
->orderByDesc('ejaculated_date')
->first();
if (!empty($previousEjaculation)) {
$ejaculatedSpan = $ejaculation->ejaculated_date
->diff($previousEjaculation->ejaculated_date)
->format('%a日 %h時間 %i分');
} else {
$ejaculatedSpan = null;
}
return view('ejaculation.show')->with(compact('user', 'ejaculation', 'ejaculatedSpan'));
return view('ejaculation.show')->with(compact('user', 'ejaculation'));
}
public function edit(Request $request, $id)