forked from eatvio/eatvio-infra
PHP Insights added
This commit is contained in:
@@ -22,6 +22,93 @@ class DiaryController extends Controller
|
||||
return redirect()->route('diary.edit', $curDiary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
dd($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Diary $diary)
|
||||
{
|
||||
/* $curDiary = Diary::find($id); */
|
||||
$daysCount = Diary::where('user_id', auth()->id())->count();
|
||||
|
||||
return view('diary.show', ['curDiary' => $diary, 'daysCount' => $daysCount]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$curDiary = Diary::find($id);
|
||||
$daysCount = Diary::where('user_id', auth()->id())->count();
|
||||
|
||||
return view(
|
||||
'diary.index',
|
||||
[
|
||||
'diaryId' => $id,
|
||||
'curDiary' => $curDiary,
|
||||
'daysCount' => $daysCount,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
/* dd($request, $id, $request->input()); */
|
||||
$curDiary = Diary::find($id);
|
||||
$curDiary->wakeup = $request->input('wakeup');
|
||||
$curDiary->retire = $request->input('retire');
|
||||
$curDiary->comment = $request->input('comment') ?? '';
|
||||
$curDiary->closed = true;
|
||||
$curDiary->save();
|
||||
|
||||
return redirect()->route('diary.show', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
}
|
||||
|
||||
private function getCurrentDiary()
|
||||
{
|
||||
$curUserId = Auth::id();
|
||||
@@ -47,91 +134,4 @@ class DiaryController extends Controller
|
||||
|
||||
return $curDiary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
dd($request);
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Diary $diary)
|
||||
{
|
||||
/* $curDiary = Diary::find($id); */
|
||||
$daysCount = Diary::where('user_id', auth()->id())->count();
|
||||
|
||||
return view('diary.show', ['curDiary' => $diary, 'daysCount' => $daysCount]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$curDiary = Diary::find($id);
|
||||
$daysCount = Diary::where('user_id', auth()->id())->count();
|
||||
|
||||
return view(
|
||||
'diary.index',
|
||||
[
|
||||
'diaryId' => $id,
|
||||
'curDiary' => $curDiary,
|
||||
'daysCount' => $daysCount,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
|
||||
/* dd($request, $id, $request->input()); */
|
||||
$curDiary = Diary::find($id);
|
||||
$curDiary->wakeup = $request->input('wakeup');
|
||||
$curDiary->retire = $request->input('retire');
|
||||
$curDiary->comment = $request->input('comment') ?? '';
|
||||
$curDiary->closed = true;
|
||||
$curDiary->save();
|
||||
|
||||
return redirect()->route('diary.show', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user