use App\Http\Controllers\Controller;
use App\Models\Ingredients\IngredientGroup;
use App\Http\Requests\Ingredients\IngredientGroup\Store;
class IngredientGroupController extends Controller
{
public function index(Recipe $recipe)
{
$this->authorize([IngredientGroup::class, $recipe]);
return $recipe->ingredientGroups()->get();
}
public function store(Recipe $recipe, Store $request)
{
$this->authorize([IngredientGroup::class, $recipe]);
$ingredientGroup = $recipe->ingredientGroups()->create($request->validated());
return $this->responseCreated('ingredient-groups.show', $ingredientGroup->id);
}
public function create(User $user, Recipe $recipe): bool
{
return $user->isOwnerOf($recipe);
}
//
}