/**
  *
  */
 private function createRecipes()
 {
     foreach (Config::get('recipes') as $tempRecipe) {
         $recipe = new Recipe(['name' => $tempRecipe['name']]);
         $recipe->user()->associate($this->user);
         $recipe->save();
         foreach ($tempRecipe['ingredients'] as $ingredient) {
             $food = Food::where('user_id', $this->user->id)->where('name', $ingredient['food'])->first();
             $recipe->foods()->attach([$food->id => ['unit_id' => Unit::where('user_id', $this->user->id)->where('name', $ingredient['unit'])->first()->id, 'quantity' => $ingredient['quantity'], 'description' => $ingredient['description']]]);
         }
         foreach ($tempRecipe['tags'] as $tempTag) {
             $tag = Tag::where('user_id', $this->user->id)->where('name', $tempTag)->first();
             $recipe->tags()->attach([$tag->id => ['taggable_type' => 'recipe']]);
         }
         $recipe->save();
     }
 }
 /**
  *
  * @param $typing
  * @return mixed
  */
 private function foods($typing)
 {
     $foods = Food::where('user_id', Auth::user()->id)->where('name', 'LIKE', $typing)->with('defaultUnit')->with('units')->get();
     return $foods;
 }
 /**
  *
  * @param Entry $entry
  * @param $index
  */
 private function attachFood(Entry $entry, $index)
 {
     $food_ids = Food::where('user_id', $this->user->id)->lists('id')->all();
     $entry->food()->associate(Food::find($food_ids[$index]));
 }