Пример #1
0
 public static function checkin(Request $request)
 {
     $page_title = "Beerhit!";
     $page_descs = "what hit you?";
     if (\Auth::user()) {
         switch ($request->id) {
             case 'drink':
                 $beer = Beer::whereSlug($request->name)->first();
                 break;
             case 'place':
                 $fb_place_id = substr(strrchr($request->name, "-"), 1);
                 $place = Places::where('place_id', $fb_place_id)->first();
                 break;
             case 'user':
                 echo 'user';
                 break;
         }
         return view('beer.beer_checkin', compact('page_title', 'page_descs', 'beer', 'place'));
     } else {
         return redirect("/auth/login");
     }
 }
Пример #2
0
 /**
  * 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);
 }
Пример #3
0
 /**
  * @param Request $request
  * @return mixed
  */
 public function quiz(Request $request)
 {
     $validator = Validator::make($request->all(), ['keywords' => 'string', 'fruits' => 'array', 'aroma' => 'boolean', 'flavors' => 'array', 'bitterness' => 'integer', 'color' => 'integer', 'maltiness' => 'boolean']);
     // one of the required post parameters was not include, error
     if ($validator->fails()) {
         return response(['status' => 'failed', 'message' => 'The request parameters contained invalid values', 'errors' => $validator->errors()], 400);
     }
     // collect the keywords that will be searched for
     $keywords = [];
     $ibu = null;
     $abv = null;
     $srm = null;
     // biggest appeal keyword
     if ($request->has('keywords')) {
         $keyword = $request->get('keywords');
         $keyword = strtok($keyword, ' ');
         array_push($keywords, $keyword);
     }
     // fruit keywords
     if ($request->has('fruits')) {
         foreach ($request->get('fruits') as $fruit) {
             $fruit = strtolower($fruit);
             $fruit = explode('/', $fruit);
             if ($fruit == 'berries') {
                 array_push($keywords, 'cherry');
                 array_push($keywords, 'raspberry');
                 array_push($keywords, 'strawberry');
             } else {
                 if (is_array($fruit)) {
                     $keywords = array_merge($keywords, $fruit);
                 } else {
                     array_push($keywords, $fruit);
                 }
             }
         }
     }
     // aroma keywords
     if ($request->has('aroma')) {
         if ($request->get('aroma')) {
             array_push($keywords, 'pine');
             array_push($keywords, 'ginger');
             array_push($keywords, 'oak');
         }
     }
     // flavor undertones keywords
     if ($request->has('flavors')) {
         foreach ($request->get('flavors') as $flavor) {
             array_push($keywords, $flavor);
         }
     }
     // get the extent of bitterness that they like
     if ($request->has('bitterness')) {
         $ibu = [];
         $bitterness = $request->get('bitterness');
         if ($bitterness == 1) {
             $ibu = [0, 33];
         } else {
             if ($bitterness == 2) {
                 $ibu = [33, 66];
             } else {
                 if ($bitterness == 3) {
                     $ibu = [66, 200];
                 }
             }
         }
     }
     if ($request->has('color')) {
         $color = $request->get('color');
         if ($color == 1) {
             $srm = [0, 14];
         } else {
             if ($color == 2) {
                 $srm = [14, 20];
             } else {
                 if ($color == 3) {
                     $srm = [20, 100];
                 }
             }
         }
     }
     // do they like malti (high abv) beers
     if ($request->has('maltiness')) {
         if ($request->get('maltiness')) {
             $abv = [6, 15];
         }
     }
     $query = Beer::query();
     // select beers based on keywords - get the union of them and then narrow it on the other parameters
     foreach ($keywords as $keyword) {
         $query->whereHas('keywords', function ($query) use($keyword) {
             $query->orWhere('name', 'like', '%' . $keyword . '%');
         });
     }
     // if the ibu has been set, select beers that fall within that range
     if (!is_null($ibu)) {
         $query->where('ibu', '>=', $ibu[0])->where('ibu', '<=', $ibu[1]);
     }
     // if the abv has been set, select beers that fall within that range
     if (!is_null($abv)) {
         $query->where('abv', '>=', $abv[0])->where('abv', '<=', $abv[1]);
     }
     // if the srm has been set, select beers that fall within that range
     if (!is_null($srm)) {
         $query->where('srm', '>=', $srm[0])->where('srm', '<=', $srm[1]);
     }
     // exclude beers that are already in a users cellar
     $usersBeers = $this->user->history()->pluck('beer_id');
     $beers = $query->with('style', 'brewery')->whereNotIn('id', $usersBeers)->get();
     // return a successful response with the beers chosen
     return response(['status' => 'ok', 'message' => 'The following beers were selected', 'beers' => [$beers], 'profile' => ['keywords' => $keywords, 'ibu' => $ibu, 'srm' => $srm, 'abv' => $abv]]);
 }
Пример #4
0
 public function gallery($slug)
 {
     $page_title = "berhit.com";
     $page_descs = "berhit.com";
     $beer = Beer::whereSlug($slug)->first();
     //ppl who drink this
     $beerImg = DB::table('beer_img')->where('beer_id', $beer->id)->select('*')->get();
     return view('beer.beer_gallery', compact('page_title', 'page_descs', 'beerImg', 'beer'));
 }
Пример #5
0
|
| 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', '.*');
Пример #6
0
 public function getEagerLoading()
 {
     return Beer::with('categories.ratings')->get();
 }
Пример #7
0
 public static function breweryBeer($brewery_id)
 {
     $data = Beer::where('beers.brewery_id', $brewery_id)->take(10)->get();
     return $data;
 }
Пример #8
0
 /**
  * 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]);
 }
Пример #9
0
 /**
  * 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]);
 }
Пример #10
0
<?php

Route::get('/', function () {
    return 'API pronta para receber chamadas';
});
Route::get('cervejarias', ['middleware' => 'cors', function () {
    return \Response::json(\App\Brewery::with('beers', 'geocode')->take(100)->get(), 200);
}]);
Route::get('breweries', ['middleware' => 'cors', function () {
    return \Response::json(\App\Brewery::with('beers', 'geocode')->take(100)->get(), 200);
}]);
Route::get('cervejas', ['middleware' => 'cors', function () {
    return \Response::json(\App\Beer::with('brewery')->paginate(10), 200);
}]);
Route::get('beers', ['middleware' => 'cors', function () {
    return \Response::json(\App\Beer::with('brewery')->paginate(10), 200);
}]);
Пример #11
0
 public function getDelete($id)
 {
     $beer = \App\Beer::find($id);
     $recipe = \App\Recipe::where('beer_id', $id)->get();
     foreach ($recipe as $item) {
         $item->delete();
     }
     $beer->delete();
     \Session::flash('flash_message', $beer->name . ' was deleted.');
     return redirect('/beer');
 }