{{ ($recipe->exists ? "Edit {$recipe->name}" : 'Add Recipe') }}

@if(session()->has('message'))
{{ session()->get('message') }}
@endif @if ($errors->any())
@foreach ($errors->all() as $error)
{{ $error }}
@endforeach
@endif
@if ($recipe->exists)@method('put')@endif @csrf

Ingredients

@for($i = 0; $i < 20; $i++) @php if (isset($recipe->foodAmounts[$i])) { $foodAmount = $recipe->foodAmounts[$i]; $amount = \App\Support\Number::fractionStringFromFloat($foodAmount->amount); $unit = $foodAmount->unit; $food_id = $foodAmount->food->id; $detail = $foodAmount->detail; } else { $foodAmount = new \App\Models\FoodAmount(); $amount = $food_id = $unit = $detail = null; } @endphp
@endfor

Steps

@for($i = 0; $i < 20; $i++) @php($step = $recipe->steps[$i] ?? new \App\Models\RecipeStep())
{{ $i + 1 }}
@endfor
{{ ($recipe->exists ? 'Save' : 'Add') }}