Add basic food show view

This commit is contained in:
Christopher C. Wells 2021-01-01 20:00:55 -08:00
parent 2e3db25388
commit 784bc490dc
3 changed files with 10 additions and 4 deletions

View File

@ -64,11 +64,11 @@ class FoodController extends Controller
* Display the specified resource.
*
* @param \App\Models\Food $food
* @return \Illuminate\Http\Response
* @return \Illuminate\Contracts\View\View
*/
public function show(Food $food)
public function show(Food $food): View
{
//
return view('foods.show')->with('food', $food);
}
/**

View File

@ -0,0 +1,4 @@
@php
$foods = [$food];
@endphp
@include('foods.index')

View File

@ -65,7 +65,9 @@
<div>
<span class="font-bold">foods:</span>
@foreach($entry->foods as $food)
{{ $food->name }}@if(!$loop->last), @endif
<a class="text-gray-500 hover:text-gray-700 hover:border-gray-300"
href="{{ route('foods.show', $food) }}">
{{ $food->name }}</a>@if(!$loop->last), @endif
@endforeach
</div>
@endif