forked from eatvio/eatvio-infra
static analisys refactoryn, View types added
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||
use App\Models\Diary;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class DiaryController extends Controller
|
||||
{
|
||||
@@ -22,33 +23,12 @@ 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)
|
||||
public function store(Request $request): void
|
||||
{
|
||||
dd($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Diary $diary)
|
||||
public function show(Diary $diary): View
|
||||
{
|
||||
/* $curDiary = Diary::find($id); */
|
||||
$daysCount = Diary::where('user_id', auth()->id())->count();
|
||||
@@ -56,14 +36,7 @@ class DiaryController extends Controller
|
||||
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)
|
||||
public function edit($id): View
|
||||
{
|
||||
$curDiary = Diary::find($id);
|
||||
$daysCount = Diary::where('user_id', auth()->id())->count();
|
||||
@@ -98,18 +71,7 @@ class DiaryController extends Controller
|
||||
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()
|
||||
private function getCurrentDiary(): Diary
|
||||
{
|
||||
$curUserId = Auth::id();
|
||||
$curDiary = Diary::userToDayItem($curUserId)->first();
|
||||
@@ -121,7 +83,7 @@ class DiaryController extends Controller
|
||||
return $this->newDiary($curUserId);
|
||||
}
|
||||
|
||||
private function newDiary($curUserId)
|
||||
private function newDiary(int $curUserId): Diary
|
||||
{
|
||||
$curDiary = new Diary();
|
||||
$curDiary->date = now()->setTimezone('3')->format('Y-m-d');
|
||||
|
||||
Reference in New Issue
Block a user