public function addNewRecipeToDb() { // @todo add all otherIngredients to the recipe as well $newRecipe = new Recipes(); $plantRecipe = new PlantRecipe(); $recipeId = sizeof(Recipes::all()) + 1; $plants = Plants::all(); $otherIngredients = Otheringredients::all(); $plantsAddedToRecipeArray = array(); $this->recipeSetup($newRecipe); foreach ($plants as $plant) { if (Input::get('plantId_' . $plant->id) === 'yes') { $plantsAddedToRecipeArray[] = $plant->id; } } $plantRecipe->savePlantRecipeConnectionToDb($recipeId, $plantsAddedToRecipeArray); $newRecipe->save(); $data = array('plants' => $plants, 'otherIngredients' => $otherIngredients); return View::make('addRecipeView')->with('data', $data); }
public function get() { return Otheringredients::all(); }