示例#1
0
 public function importData()
 {
     $siswas = Siswa::all();
     foreach ($siswas as $siswa) {
         ini_set('max_execution_time', 300);
         $student = new Student();
         $student->name = $siswa->FullName;
         if ($siswa->Sex == 'MALE') {
             $student->sex = 'L';
             $student->photo = 'boy.png';
         } else {
             $student->sex = 'P';
             $student->photo = 'girl.png';
         }
         $student->birthplace = $siswa->BirthPlace;
         $student->birthdate = $siswa->BirthDate;
         $student->religion = $siswa->Religion;
         $student->address = $siswa->FullAddress;
         $student->contact = $siswa->CellPhone;
         $student->father_name = $siswa->FatherName;
         $student->father_occupation = $siswa->FatherOccupation;
         $student->father_address = $siswa->FatherAddress;
         $student->father_contact = $siswa->FatherContact;
         $student->mother_name = $siswa->MotherName;
         $student->mother_occupation = $siswa->MotherOccupation;
         $student->mother_address = $siswa->MotherAddress;
         $student->mother_contact = $siswa->MotherContact;
         $student->save();
     }
     Session::flash('message', 'Sukses mengimport Data Siswa');
     return Redirect::to('/');
 }
示例#2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $siswa = Siswa::all();
     return View::make('siswa.index')->with('siswa', $siswa);
 }
示例#3
0
 public function tambah_siswa($id)
 {
     $rombel = Rombel::find($id);
     $siswa = Siswa::all();
     $detail = DB::table('siswa_rombel')->where('kd_rombel', '=', $id)->join('siswa', 'siswa.nis', '=', 'siswa_rombel.nis')->get();
     return View::make('rombel.tambah_siswa')->with('rombel', $rombel)->with('siswa', $siswa)->with('detail', $detail);
 }