static analisys refactoryn, View types added

This commit is contained in:
Anatoliy Poloz
2023-12-29 10:59:20 +03:00
parent 9b2d703374
commit 8e97a8abd4
14 changed files with 62 additions and 718 deletions

View File

@@ -3,35 +3,22 @@
namespace App\Http\Controllers;
use App\Models\Recipe;
use Illuminate\Contracts\View\View;
use Illuminate\Contracts\View\Factory as ViewFactory;
class RecipeController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
public function index(): View|ViewFactory
{
return view('recipe/index');
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
public function create(): View|ViewFactory
{
return view('recipe/edit_form');
}
/**
* Display the specified resource.
*
* @return \Illuminate\Http\Response
*/
public function show(Recipe $recipe)
public function show(Recipe $recipe): View|ViewFactory
{
$data = [
'author' => $recipe->author()->first(),
@@ -48,12 +35,7 @@ class RecipeController extends Controller
return view('recipe/show', $data);
}
/**
* Show the form for editing the specified resource.
*
* @return \Illuminate\Http\Response
*/
public function edit(Recipe $recipe)
public function edit(Recipe $recipe): View|ViewFactory
{
return view('recipe/edit_form', ['recipe' => $recipe]);
}