diff --git a/app/Http/Controllers/RecipeController.php b/app/Http/Controllers/RecipeController.php
index ae1116b..3c9fb8d 100644
--- a/app/Http/Controllers/RecipeController.php
+++ b/app/Http/Controllers/RecipeController.php
@@ -254,4 +254,26 @@ class RecipeController extends Controller
return redirect()->route('recipes.show', $recipe);
}
+ /**
+ * Confirm removal of specified resource.
+ */
+ public function delete(Recipe $recipe): View
+ {
+ return view('recipes.delete')->with('recipe', $recipe);
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ */
+ public function destroy(Recipe $recipe): RedirectResponse
+ {
+ // Remove the recipe from any recipes.
+ foreach ($recipe->ingredientAmountRelationships as $ia) {
+ $ia->delete();
+ }
+ $recipe->delete();
+ return redirect(route('recipes.index'))
+ ->with('message', "Recipe {$recipe->name} deleted!");
+ }
+
}
diff --git a/resources/views/recipes/delete.blade.php b/resources/views/recipes/delete.blade.php
new file mode 100644
index 0000000..5ee5724
--- /dev/null
+++ b/resources/views/recipes/delete.blade.php
@@ -0,0 +1,46 @@
+
+ Delete {{ $recipe->name }}?
+
+