public function run()
 {
     DB::table('mahasiswa')->delete();
     DB::table('wali')->delete();
     DB::table('dosen')->delete();
     $darwis = Dosen::create(array('nama' => 'Darwis', 'nip' => '12321310'));
     $nabil = Mahasiswa::create(array('nama' => 'Nabil Farras', 'nim' => '1103124323', 'id_dosen' => $darwis->id));
     $dani = Mahasiswa::create(array('nama' => 'Dani Firdaus', 'nim' => '11031202323', 'id_dosen' => $darwis->id));
     $this->command->info('Mahasiswa telah diisi!');
     Wali::create(array('nama' => 'Darto', 'id_mahasiswa' => $nabil->id));
     Wali::create(array('nama' => 'Iman', 'id_mahasiswa' => $dani->id));
 }
Example #2
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Wali::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }