public function beer($slug) { $page_title = "Beerhit!"; $page_descs = "what hit you?"; $beer = Beer::where('beers.slug', $slug)->join('beer_style', 'beers.style_id', '=', 'beer_style.id')->join('brewery', 'beers.brewery_id', '=', 'brewery.id')->select('beers.*', 'beer_style.id as beer_style_id', 'beer_style.id as beer_style_style,', 'brewery.slug as b_slug', 'brewery.id as b_id', 'brewery.name as b_name', 'brewery.city as b_city')->first(); $similar_style = Beer::where('beers.style_id', $beer->style_id)->take(10)->get(); $beer_id = $beer->id; DB::table('beers')->where('id', $beer_id)->increment('views'); //Get other beers from the same brewery $from_brewery = Beer::where('beers.brewery_id', $beer->brewery_id)->take(10)->get(); $beer_drink = UserBeer::userBeerCnt($beer_id); //ppl who drink this $beer_checkin = Checkin::checkinBeer($beer_id); //checkin locations with this beer $beerImg = BeerImg::getBeerImg($beer_id); //get all uploaded beer images return view('beer.beer', compact('page_title', 'page_descs', 'beer', 'beerImg', 'beer_drink', 'beer_ratings', 'similar_style', 'from_brewery', 'beer_checkin')); }
/** * Get beers by their color values. Can pass either start SRM value, start and end SRM values, or the color ID. * * @param Request $request * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response */ public function beers(Request $request) { $start = $request->get('start'); $end = $request->get('end'); $colorId = $request->get('color_id'); if (!empty($start) && !empty($end)) { $beers = Beer::where('srm', '>=', $start)->where('srm', '<=', $end)->get(); return response(['status' => 'ok', 'message' => 'Beers that fall in the SRM range of ' . $start . ' and ' . $end, 'beers' => $beers]); } else { if (!empty($start)) { $beers = Beer::where('srm', '=', $start)->get(); return response(['status' => 'ok', 'message' => 'Beers that have the SRM value of ' . $start, 'beers' => $beers]); } else { if (!empty($colorId)) { $color = Color::find($colorId); if (!!$color) { $beers = Beer::where('srm', '>=', $color->start)->where('srm', '<=', $color->end)->get(); return response(['status' => 'ok', 'message' => 'Beers that are of the color ' . $color->name . ' (id: ' . $colorId . ')', 'beers' => $beers]); } } } } return response(['status' => 'failed', 'message' => 'Invalid data received. You must provide the range of SRM values with the name start and end,' . 'or a color ID must be provided. To get a list of colors including their ID, name, start and end range ' . 'perform a GET request on the color index route.', 'errors' => 'Bad values received'], 400); }
| | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ use App\User; use App\Beer; Route::get('/', function () { return view('welcome'); }); Route::get('/api/v1/beers', function () { header("Access-Control-Allow-Origin: *"); return Beer::with('categories.ratings')->get(); }); Route::get('/api/v1/crisp', function () { }); Route::get('/api/v1/search/{parameter}', function ($parameter) { header("Access-Control-Allow-Origin: *"); if (!$parameter) { return []; } return Beer::where('name', 'LIKE', '%' . $parameter . '%')->get(); }); Route::get('/api/v1/beer/{id}', function ($id) { return Beer::find($id)->with('categories')->first(); }); Route::resource('api/v1/beer', 'BeerController'); Route::any('{all}', function ($uri) { return ['status' => 'Not Found']; })->where('all', '.*');
public static function breweryBeer($brewery_id) { $data = Beer::where('beers.brewery_id', $brewery_id)->take(10)->get(); return $data; }
/** * 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]); }
/** * Get the beer recommendations for a user. Create a user's taste profile using the star rating system as a weight * and provide recommendations for beers that fall in a user's profile. * * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response */ public function recommend() { // get the history/past beers for a user $history = History::with('beer')->where('user_id', '=', $this->user->id)->get(); // define the variables that serve as predictors $count = count($history); $starCount = 0; $srm = 0; $abv = 0; $ibu = 0; // ensure that the cellar has beers if ($count == 0) { return response(['status' => 'failed', 'message' => 'To get a recommendation the user\'s cellar must contain beers.']); } // add variable to its total weighted value foreach ($history as $rating) { $beer = $rating->beer; $starCount += $rating->rating; $srm += $beer->srm * $rating->rating; $abv += $beer->abv * $rating->rating; $ibu += $beer->ibu * $rating->rating; } // determine the mean weight values $srm /= $starCount; $abv /= $starCount; $ibu /= $starCount; // exclude beers that are already in a users cellar $usersBeers = $this->user->history()->pluck('beer_id'); // retrieve beers that fall within a certain range of the means $beers = Beer::where('srm', '>=', $srm - 1.5)->where('srm', '<=', $srm + 1.5)->where('ibu', '>=', $ibu - 15)->where('ibu', '<=', $ibu + 15)->where('abv', '>=', $abv - 0.75)->where('abv', '<=', $abv + 0.75)->with('style', 'brewery')->whereNotIn('id', $usersBeers)->get(); return response(['status' => 'ok', 'message' => 'The following beers are in the user\'s recommendation profile', 'profile' => ['srm' => $srm, 'ibu' => $ibu, 'abv' => $abv], 'beers' => $beers]); }