Esempio n. 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::table('locker_gewenst')->truncate();
     $aantal = Leerling::get()->count();
     //$aantal= 2;
     $lockersGewenst = factory(LockerGewenst::class, $aantal)->create();
     for ($i = 0; $i < $aantal; ++$i) {
         $lockersGewenst[$i]->leerling()->associate(Leerling::find($i + 1));
         $lockersGewenst[$i]->save();
     }
     Model::reguard();
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     DB::table('locker_sleutel_verloren')->truncate();
     $aantal = Locker::get()->count();
     //$aantal=2;
     $sleutelsverloren = factory(LockerSleutelVerloren::class, $aantal)->create();
     $lockers = Locker::all();
     for ($i = 0; $i < $aantal; ++$i) {
         //$leerling=$lockers[$i]->leerling();
         $sleutelsverloren[$i]->locker()->associate($lockers[$i]);
         $sleutelsverloren[$i]->leerling()->associate(Leerling::find($lockers[$i]->leerling_id));
         //$sleutelsverloren[$i]->leerling()->associate($lockers[$i]->leerling());
         //if ($i==0) var_dump($lockers[$i]->leerling()->get());
         $sleutelsverloren[$i]->save();
     }
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     Model::reguard();
 }
Esempio n. 3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $object = Leerling::find($id);
     // show the view and pass the nerd to it
     return view('leerlingen.show')->with('leerling', $object);
 }