<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Ingredients;

class IngredientsController extends Controller
{
    public function index()
    {
        return Ingredients::all();
    }

    public function store(Request $request)
    {
        $ingredients = Ingredients::create($request->all());
        $data = "Successfully stored the data";
        return response()->json($data, 200);
    }

    // public function show($id)
    // {
    //     $ingredients = Ingredients::findorfail($id);
    //     $ingredients->load('products');

    //     return response()->json([
    //         'status' => true , 
    //         'data' => $ingredients,
    //         'message' => "Ingredents retrieve successfully!" , 
    //     ], 200);
    // }
}
