チェックイン単独のページを追加
This commit is contained in:
@@ -42,9 +42,26 @@ class EjaculationController extends Controller
|
||||
return redirect()->route('home')->with('status', 'チェックインしました!');
|
||||
}
|
||||
|
||||
public function show()
|
||||
public function show($id)
|
||||
{
|
||||
// TODO: not implemented
|
||||
$ejaculation = Ejaculation::findOrFail($id);
|
||||
$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'));
|
||||
}
|
||||
|
||||
public function edit()
|
||||
|
Reference in New Issue
Block a user