mirror of https://github.com/kcal-app/kcal.git
Add basic food show view
This commit is contained in:
parent
2e3db25388
commit
784bc490dc
|
|
@ -64,11 +64,11 @@ class FoodController extends Controller
|
||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
* @param \App\Models\Food $food
|
* @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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
@php
|
||||||
|
$foods = [$food];
|
||||||
|
@endphp
|
||||||
|
@include('foods.index')
|
||||||
|
|
@ -65,7 +65,9 @@
|
||||||
<div>
|
<div>
|
||||||
<span class="font-bold">foods:</span>
|
<span class="font-bold">foods:</span>
|
||||||
@foreach($entry->foods as $food)
|
@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
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue