Exemplo n.º 1
0
 /**
  * Responds to requests to POST /batches/create
  */
 public function postCreate(Request $request)
 {
     $batch = new \p4\Batch();
     $batch->batch_name = $request->batch_name;
     $batch->date_completed = $request->date_completed;
     $batch->user_id = Auth::id();
     $batch->recipe_used = $request->recipe_used;
     $batch->starting_gravity = $request->starting_gravity;
     $batch->ending_gravity = $request->ending_gravity;
     $batch->batch_notes = $request->batch_notes;
     $batch->save();
     \Session::flash('flash_message', 'Your batch has been added!');
     return redirect('/batches/show');
 }
Exemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     for ($i = 1; $i <= 9; $i++) {
         $batch = new \p4\Batch();
         $counter = $i;
         $batch->batch_name = 'Batch Name ' . $counter;
         $batch->user_id = $counter;
         $batch->date_completed = Carbon\Carbon::now()->addDay($counter);
         $batch->recipe_used = $i;
         $batch->starting_gravity = 1.1;
         $batch->ending_gravity = 1.01;
         $batch->batch_notes = "This is a note about this batch";
         $batch->save();
     }
 }