Esempio n. 1
0
 /**
  *responds to GET /recipes/myrecipes
  */
 public function getMyRecipes()
 {
     $user = \Auth::user();
     $recipes = \P4\Recipe::where('user_id', '=', \Auth::id())->orderBy('id', 'DESC')->get();
     $data = array('user' => $user, 'recipes' => $recipes);
     return view('recipes.myrecipes')->with($data);
 }
Esempio n. 2
0
 public function getIndex()
 {
     if (\Auth::check()) {
         $user = \Auth::user();
         $recipes = \P4\Recipe::where('user_id', '=', \Auth::id())->orderBy('id', 'DESC')->get();
         $data = array('user' => $user, 'recipes' => $recipes);
         return view('welcome.index')->with($data);
     } else {
         return view('welcome.guestIndex');
     }
 }
Esempio n. 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $recipes = ['Italian Ciabatta Burgers' => ['Beef', 'Sandwich'], 'Asian Noodle Salad' => ['Pasta', 'Sides', 'Salad'], 'Caesar Salad' => ['Appetizers', 'Salad', 'Sides'], 'Glazed Teriyaki Chicken' => ['Chicken'], 'Southwestern Chicken Sausage Chili' => ['Appetizers', 'Sides'], 'Coconut-Crusted Chicken Fingers' => ['Chicken'], 'Steak Au Poivre' => ['Beef', 'Sides']];
     foreach ($recipes as $title => $tags) {
         $recipe = \P4\Recipe::where('title', 'like', $title)->first();
         foreach ($tags as $tagName) {
             $tag = \P4\Tag::where('tag_name', 'like', $tagName)->first();
             $recipe->tags()->save($tag);
         }
     }
 }
Esempio n. 4
0
 /**
  * Responds to requests to GET /batches/create
  */
 public function getCreate($incomingRecipeID = null)
 {
     //get list of recipes currently in the database for selection by the user
     $recipes = \p4\Recipe::all();
     if ($incomingRecipeID != null) {
         $recipeLookup = \p4\Recipe::where('id', '=', $incomingRecipeID)->get();
         //return 'THIS IS THE INCOMING RECIPE: '.$recipeLookup;
         return view('batches.create')->with('recipes', $recipeLookup);
     } else {
         //return 'Form to create a new batch';
         return view('batches.create')->with('recipes', $recipes);
     }
 }
Esempio n. 5
0
 /**
  * Responds to requests to GET /recipes/show/{id}
  */
 public function getRecipe($id)
 {
     $recipe = \p4\Recipe::where('id', '=', $id)->first();
     return view('recipes.showIndividual')->with('recipe', $recipe);
 }