/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $suppliers = Supplier::all(); $ingredients = Ingredient::all(); $supplyorder = Supplyorder::find($id); return view('supplyorder.show', ['supplyorder' => $supplyorder, 'ingredients' => $ingredients, 'suppliers' => $suppliers]); }
public function destroy(Request $request) { foreach ($request->input('to_delete') as $item_id) { Ingredient::destroy($item_id); } return Redirect::to('ingredients'); }
/** * Run the database seeds. * * @return void */ public function run() { $rpaprika = new App\Ingredient(); $rpaprika->name = 'Rode paprika'; $rpaprika->unit = 'stuks'; $rpaprika->type = 'groente'; $rpaprika->min_amount = 1; $rpaprika->save(); $grpaprika = new App\Ingredient(); $grpaprika->name = 'Groene paprika'; $grpaprika->unit = 'stuks'; $grpaprika->type = 'groente'; $grpaprika->min_amount = 1; $grpaprika->save(); $gpaprika = new App\Ingredient(); $gpaprika->name = 'Gele paprika'; $gpaprika->unit = 'stuks'; $gpaprika->type = 'groente'; $gpaprika->min_amount = 1; $gpaprika->save(); $aubergine = new App\Ingredient(); $aubergine->name = 'Aubergine'; $aubergine->unit = 'stuks'; $aubergine->type = 'groente'; $aubergine->min_amount = 1; $aubergine->save(); $courgette = new App\Ingredient(); $courgette->name = 'Courgette'; $courgette->unit = 'stuks'; $courgette->type = 'groente'; $courgette->min_amount = 1; $courgette->save(); $ui = new App\Ingredient(); $ui->name = 'Uien'; $ui->unit = 'stuks'; $ui->type = 'groente'; $ui->min_amount = 3; $ui->save(); $knoflook = new App\Ingredient(); $knoflook->name = 'Knoflook'; $knoflook->unit = 'stuks'; $knoflook->type = 'groente'; $knoflook->min_amount = 1; $knoflook->save(); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $response = array(); $ingredients = Ingredient::all('id', 'name'); foreach ($ingredients as $ingredient) { array_push($response, ['label' => $ingredient->name, 'value' => $ingredient->id]); } return response()->json($response); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('ingredients')->delete(); Ingredient::create(array('Name' => 'Flour', 'MeasurementType' => 'cups')); Ingredient::create(array('Name' => 'Butter', 'MeasurementType' => 'tablespoon')); Ingredient::create(array('Name' => 'Baking Powder', 'MeasurementType' => 'teaspoons')); Ingredient::create(array('Name' => 'Eggs', 'MeasurementType' => 'ea')); Ingredient::create(array('Name' => 'Oil', 'MeasurementType' => 'tablespoons')); }
/** * Run the database seeds. * * @return void */ public function run() { $recipes = ['baked potatoes with wild mushroom ragù' => ['potatoTest'], 'Buttermilk, Cornmeal Pancakes with Corn Salsa' => ['cornTest'], 'Thai Basil Eggplant' => ['eggplantTest']]; foreach ($recipes as $title => $ingredients) { $recipe = \App\Recipe::where('title', 'like', $title)->first(); foreach ($ingredients as $ingredient) { $ingredientName = \App\Ingredient::where('name', 'LIKE', $ingredient)->first(); $recipe->ingredients()->save($ingredientName); } } }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $ingredient = Ingredient::findOrFail($id); $ingredient->name = $request->input('name'); $ingredient->unit = $request->input('unit'); $ingredient->type = $request->input('type'); $ingredient->min_amount = $request->input('min_amount'); if (!$ingredient->save()) { return redirect()->action('IngredientsController@show', [$id])->with('status', 'Ingredient update mislukt!'); } return redirect()->action('IngredientsController@show', [$id])->with('status', 'Ingredient update geslaagd!'); }
/** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { $router->model('effects', 'App\\Effect'); $router->model('potion-effects', 'App\\PotionEffect'); $router->bind('potions', function ($id) { return Potion::with('ingredients')->where('id', $id)->first(); }); $router->bind('ingredients', function ($id) { return Ingredient::with('effects')->where('id', $id)->first(); }); parent::boot($router); }
public function update(Request $request) { if (!$this->isUnique($request->name)) { return Response::json("This ingredient already exists", 400); exit; } $recipe = Ingredient::find($request->id); $ingredient->name = $request->name; $ingredient->quantity = $request->quantity; $ingredient->measure = $request->measure; $ingredient->save(); echo json_encode(true); exit; }
function ingredientsFromString($str, Recipe $recipe) { $ingredients = explode(',', $str); foreach ($ingredients as $ingredient) { $ingToSave = \App\Ingredient::where('name', '=', trim($ingredient))->first(); ## Check singular form if necessary if (!isset($ingToSave)) { $ingToSave = \App\Ingredient::where('name', '=', trim(str_singular($ingredient)))->first(); } ## Links ingredient to recipe, or adds new ingredient and links if (isset($ingToSave)) { $recipe->ingredients()->save($ingToSave); } else { $newIng = new \App\Ingredient(); $newIng->name = $ingredient; $newIng->save(); $recipe->ingredients()->save($newIng); } } }
public function modifyIngredient(Request $request, $ingredient_id) { $ingr = \App\Ingredient::findOrFail($ingredient_id); if ($request->name != "") { $ingr->name = $request->name; } $ingr->type = $request->type; $ingr->save(); return redirect()->route('ingredients'); }
public function getEdit($id = null) { $beer = \App\Beer::find($id); $recipe = \App\Recipe::where('beer_id', $id)->get(); $ingredients = \App\Ingredient::get(); if (is_null($beer)) { \Session::flash('flash_message', 'Beer not found.'); return redirect('\\beer'); } # array to populate a drop down on edit blade $measures = ['oz', 'lb', 'tsp', 'tbsp', 'package']; return view('beer.edit')->with('beer', $beer)->with('recipe', $recipe)->with('ingredients', $ingredients)->with('measures', $measures); }
public function getTest() { $ingredients = \App\Ingredient::orderBy('name')->get(); return view('test')->with('ingredients', $ingredients); }
public function destroy(Ingredient $ingredient) { $ingredient->delete(); }
/* |-------------------------------------------------------------------------- | Model Factories |-------------------------------------------------------------------------- | | Here you may define all of your model factories. Model factories give | you a convenient way to create models for testing and seeding your | database. Just tell the factory how a default model should look. | */ $factory->define(App\User::class, function (Faker\Generator $faker) { $firs_name = $faker->firstName; $last_name = $faker->lastName; return ['first_name' => $firs_name, 'last_name' => $last_name, 'full_name' => $firs_name . ' ' . $last_name, 'avatar' => config('application.files.avatars.public_path') . $faker->file(public_path(config('application.files.avatars.tmp_path')), public_path(config('application.files.avatars.public_path')), false), 'role' => 'user', 'email' => $faker->unique()->email, 'phone' => $faker->phoneNumber, 'password' => '123456']; }); $factory->define(App\Category::class, function (Faker\Generator $faker) { $name = $faker->sentence(1); return ['name' => $name, 'description' => $faker->sentence(30), 'image' => config('application.files.categories.public_path') . $faker->file(public_path(config('application.files.categories.tmp_path')), public_path(config('application.files.categories.public_path')), false)]; }); $factory->define(App\Dish::class, function (Faker\Generator $faker) { $name = $faker->sentence(5); return ['name' => $name, 'description' => $faker->sentence(30), 'content' => $faker->sentence(50), 'image' => config('application.files.dishes.public_path') . $faker->file(public_path(config('application.files.dishes.tmp_path')), public_path(config('application.files.dishes.public_path')), false), 'difficulty' => $faker->randomElement(['low', 'half', 'high']), 'category_id' => \App\Category::all()->random()->id, 'user_id' => \App\User::all()->random()->id]; }); $factory->define(App\Ingredient::class, function (Faker\Generator $faker) { $name = $faker->sentence(2); return ['name' => $name, 'unit' => $faker->randomElement(config('application.units')), 'description' => $faker->sentence(30), 'image' => config('application.files.ingredients.public_path') . $faker->file(public_path(config('application.files.ingredients.tmp_path')), public_path(config('application.files.ingredients.public_path')), false), 'price' => $faker->randomFloat(2, 0, 3), 'user_id' => \App\User::all()->random()->id]; }); $factory->define(App\DishIngredient::class, function (Faker\Generator $faker) { return ['quantity' => $faker->randomNumber(2), 'unit' => $faker->randomElement(config('application.units')), 'description' => $faker->sentence(5), 'dish_id' => \App\Dish::all()->random()->id, 'ingredient_id' => \App\Ingredient::all()->random()->id, 'price' => $faker->randomFloat(2, 0, 3)]; });
public function getSecret() { $data['recipe'] = Recipe::find(1); $data['recipe']['ingredients'] = Ingredient::where('recipe_id', '=', Recipe::find(1)->id)->get(); return response()->json($data); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $ingredient = Ingredient::find($id); Activity::log('Deleted the ' . $ingredient->name . ' ingredient from the system'); $ingredient->delete(); return Redirect::back()->with('status', 'Ingredient removed!'); }
public function listIngredients() { $ingredients = Ingredient::get(); return view('manager.list-ingredients', compact('ingredients')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $recipe = Recipe::find($id); $ingredients = Ingredient::all()->sortBy('name'); $tags = Tag::where('for', 'recipe')->get(); return view('recipes.edit')->with(['recipe' => $recipe, 'ingredients' => $ingredients, 'tags' => $tags]); }
public function update($id) { $meal = Meal::find($id); $meal->name = Input::get('name'); $meal->description = Input::get('description'); $meal->street = Input::get('street'); $meal->city = Input::get('city'); $meal->zip_code = Input::get('zip_code'); $meal->seats = Input::get('seats'); // get and parse date $date = Input::get('meal_date'); $date_array = explode("/", $date); $day = (int) $date_array[0]; $month = (int) $date_array[1]; $year = (int) $date_array[2]; // get and parse time $time = Input::get('meal_time'); $time_array = explode(":", $time); $hour = (int) $time_array[0]; $minutes = (int) $time_array[1]; // create new dateTime $date_time = Carbon::create($year, $month, $day, $hour, $minutes); $meal->meal_date_time = $date_time; // create ingredients $ingredients = Input::get('ingredient'); $meal_ingredients = array(); foreach ($ingredients as $ingredient) { $meal_ingredients[] = Ingredient::firstOrNew(array('name' => $ingredient['name']))->fill(array('unit' => $ingredient['unit'], 'quantity' => $ingredient['quantity'])); } // delete existing ingredients foreach ($meal->ingredients as $ingredient) { if (!in_array($ingredient, $meal_ingredients)) { $ingredient->delete(); } } //save into the DB $meal->save(); $meal->ingredients()->saveMany($meal_ingredients); // redirect Flash::success('Votre repas a bien été mis à jour!'); return Redirect::route('meals.show', $meal); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function supply() { $measure = Ingredient::all(); return view('metrics.supply', ['measure' => $measure]); }
/** * Run the database seeds. * * @return void */ public function run() { //type 1 - grain, 2 - hops, 3 - yeast, 4 - sugar, 4 - additives $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '2 Row Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain1', 'amt' => '15', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Crystal Malt 40L')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain2', 'amt' => '1', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Munich Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain3', 'amt' => '.5', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Victory Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain4', 'amt' => '.5', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Columbus')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops1', 'amt' => '3', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Cascade')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops2', 'amt' => '4', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Wyeast 1056-Ale American')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '3', 'order' => 'yeast', 'amt' => '1', 'measure' => 'package', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Amylase Enzyme')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive1', 'amt' => '1', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive2', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar1', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar2', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Liberty Bay IPA')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); //type 1 - grain, 2 - hops, 3 - yeast, 4 - sugar, 4 - additives $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '2 Row Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain1', 'amt' => '15', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Crystal Malt 40L')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain2', 'amt' => '1', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Munich Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain3', 'amt' => '.5', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Victory Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain4', 'amt' => '.5', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Columbus')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops1', 'amt' => '3', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Cascade')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops2', 'amt' => '4', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Wyeast 1056-Ale American')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '3', 'order' => 'yeast', 'amt' => '1', 'measure' => 'package', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Amylase Enzyme')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive1', 'amt' => '1', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive2', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar1', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar2', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Alaskan Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); //type 1 - grain, 2 - hops, 3 - yeast, 4 - sugar, 4 - additives $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '2 Row Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain1', 'amt' => '15', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Crystal Malt 40L')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain2', 'amt' => '1', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Munich Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain3', 'amt' => '.5', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Victory Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain4', 'amt' => '.5', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Columbus')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops1', 'amt' => '3', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Cascade')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops2', 'amt' => '4', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Wyeast 1056-Ale American')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '3', 'order' => 'yeast', 'amt' => '1', 'measure' => 'package', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Amylase Enzyme')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive1', 'amt' => '1', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive2', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar1', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar2', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jill Lager')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); //type 1 - grain, 2 - hops, 3 - yeast, 4 - sugar, 4 - additives $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '2 Row Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain1', 'amt' => '15', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Crystal Malt 40L')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain2', 'amt' => '1', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Munich Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain3', 'amt' => '.5', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Victory Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain4', 'amt' => '.5', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Columbus')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops1', 'amt' => '3', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Cascade')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops2', 'amt' => '4', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Wyeast 1056-Ale American')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '3', 'order' => 'yeast', 'amt' => '1', 'measure' => 'package', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Amylase Enzyme')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive1', 'amt' => '1', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive2', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar1', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar2', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Amber')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); //type 1 - grain, 2 - hops, 3 - yeast, 4 - sugar, 4 - additives $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '2 Row Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain1', 'amt' => '15', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Crystal Malt 40L')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain2', 'amt' => '1', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Munich Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain3', 'amt' => '.5', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Victory Malt')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain4', 'amt' => '.5', 'measure' => 'lb', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '1', 'order' => 'grain5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Columbus')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops1', 'amt' => '3', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Cascade')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops2', 'amt' => '4', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '2', 'order' => 'hops5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Wyeast 1056-Ale American')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '3', 'order' => 'yeast', 'amt' => '1', 'measure' => 'package', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', 'Amylase Enzyme')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive1', 'amt' => '1', 'measure' => 'oz', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive2', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '5', 'order' => 'additive5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar1', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar2', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar3', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar4', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); $beer_id = \App\Beer::where('beer_name', '=', 'Jamal Porter')->pluck('id'); $ingredient_id = \App\Ingredient::where('name', '=', '')->pluck('id'); DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'type' => '4', 'order' => 'sugar5', 'amt' => '', 'measure' => '', 'beer_id' => $beer_id, 'ingredient_id' => $ingredient_id]); }
public function showRecipes($id = null) { $ingredient = \App\Ingredient::find($id); $recipes = $ingredient->recipes()->get(); return view('show')->with('recipes', $recipes); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $ingredient = Ingredient::findOrFail($id); $ingredient->delete(); Alert::danger('messages.ingredient_successfully_deleted'); return redirect()->route('ingredients.index'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $ingredient = Ingredient::find($id); $ingredient->delete(); return redirect()->route('ingredient.index'); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show(Request $request, $id) { $food = Food::where('id', $id)->first(); $food_ingredient = Ingredient::where('food_id', $id)->get(); $proteins = $food->proteins; $carbs = $food->carbs; $fats = $food->fats; $fibre = $food->fibre; $kcal = $food->kcal; $chart_data = ['proteins' => $proteins, 'fats' => $fats, 'carbs' => $carbs, 'fibre' => $fibre, 'kcal' => $kcal]; $chart_data = json_encode($chart_data); return view('foods.show')->with('food', $food)->with('food_ingredient', $food_ingredient)->with('chart_data', $chart_data); }
/** * Creates all recipe ingredients * * @param Request $request * @param int|string $recipeId */ private function saveIngredients(Request $request, $recipeId) { foreach ($request->get('ingredient') as $ingredient) { if (!$request->exists('amount-' . $ingredient)) { continue; } // creates new recipe ingredients if (is_numeric($ingredient)) { if (Ingredient::exists($ingredient) === false) { continue; } if ($request->exists('updateIngredient')) { DB::enableQueryLog(); if (in_array($ingredient, $request->get('updateIngredient'))) { $recipeIngredient = RecipeIngredient::where(function ($query) use($recipeId, $ingredient) { $query->where('recipe_id', '=', $recipeId)->where('ingredient_id', '=', $ingredient); })->first(); $recipeIngredient->amount = $request->get('amount-' . $ingredient); $recipeIngredient->save(); continue; } } $recipeIngredient = new RecipeIngredient(); $recipeIngredient->recipe_id = $recipeId; $recipeIngredient->ingredient_id = $ingredient; $recipeIngredient->amount = $request->get('amount-' . $ingredient); $recipeIngredient->save(); } else { $newIngredient = new Ingredient(); $newIngredient->name = ucfirst(str_replace('-', ' ', $ingredient)); if ($newIngredient->save()) { $recipeIngredient = new RecipeIngredient(); $recipeIngredient->recipe_id = $recipeId; $recipeIngredient->ingredient_id = $newIngredient->id; $recipeIngredient->amount = $request->get('amount-' . $ingredient); $recipeIngredient->save(); } } } }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $id = $request->id; $productionSchedule = Batch::find($id); $productionSchedule->product_id = $request->Product; $productionSchedule->batches = $request->Batches; $productionSchedule->proddate = $request->Date; $productionSchedule->status_id = $request->Status; $productionSchedule->save(); if ($productionSchedule->status_id == 3) { $product = Product::find($productionSchedule->product_id); $addInventory = $productionSchedule->batches * $product->units_per_batch; $product->inventory = $product->inventory + $addInventory; $product->save(); // for each ingredient in the recipe subtract the units required to make the batch $currentIngredientQuantity = $product->ingredient()->get(); $batches = $productionSchedule->batches; foreach ($currentIngredientQuantity as $i) { $ingredient = Ingredient::find($i->id); $multipleIngredientBatch = $batches * $i->pivot->quantity; $ingredient->quantity = $ingredient->quantity - $multipleIngredientBatch; $ingredient->save(); } Activity::log('Completed ' . $productionSchedule->batches . ' batches of ' . $productionSchedule->product->name . '.'); } else { Activity::log('Updated production schedule #' . $productionSchedule->id . '.'); } $request->session()->flash('status', 'Production schedule was successfully updated.'); return Redirect::action('ProductionController@index'); }
public function update(Request $request, $id) { $product = Product::findOrFail($id); $allIngredients = Ingredient::get()->toArray(); $ingredientsInProduct = $product->ingredients->toArray(); $product->update($request->all()); foreach ($ingredientsInProduct as $ingredient) { if (array_search($ingredient['name'], $request->input('ingredient-list')) === false) { IngredientsInProduct::where('product_id', $id)->where('ingredient_id', $ingredient['id'])->delete(); } } foreach ($request->input('ingredient-list') as $inputIngredient) { if (is_int($this->ingredientSearch($inputIngredient, $ingredientsInProduct, 'name'))) { } elseif (is_int($this->ingredientSearch($inputIngredient, $allIngredients, 'name'))) { $attachIngredientToProduct = new IngredientsInProduct(); $attachIngredientToProduct->product_id = $id; $attachIngredientToProduct->ingredient_id = $allIngredients[array_search($inputIngredient, array_column($allIngredients, 'name'))]['id']; $attachIngredientToProduct->save(); } else { $newIngredient = new Ingredient(); $newIngredient->name = $inputIngredient; $newIngredient->unit = 'stuks'; $newIngredient->type = 'groente'; $newIngredient->min_amount = 1; $newIngredient->save(); $attachIngredientToProduct = new IngredientsInProduct(); $attachIngredientToProduct->product_id = $id; $attachIngredientToProduct->ingredient_id = $newIngredient->id; $attachIngredientToProduct->save(); } } return redirect()->action('ProductsController@edit', [$id])->with('status', 'Ingredient update is geslaagd!'); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $ingredients = Ingredient::all(); return view('pizzas.create', compact('ingredients')); }