/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     DB::table('categories')->truncate();
     DB::table('products')->truncate();
     $category = new Category();
     $category->name = "Blood";
     $category->save();
     foreach (BloodGroup::all() as $bg) {
         $product = new Product();
         $product->name = $bg->name;
         $product->validity_period = 120;
         $product->category_id = $category->id;
         $product->save();
     }
     $category = new Category();
     $category->name = "General";
     $category->save();
 }
Example #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $donor = Donor::find($id);
     $blood_groups = array('') + BloodGroup::all()->lists('name', 'id');
     return View::make('donors.create', array('donor' => $donor, 'blood_groups' => $blood_groups));
 }