예제 #1
0
 public function store()
 {
     if (Auth::check()) {
         $data = new Siswa();
         $data->nisn = \Input::get('nisn');
         $data->namalengkap = \Input::get('namalengkap');
         $data->namapanggilan = \Input::get('namapanggilan');
         $data->tempatlahir = \Input::get('tempatlahir');
         $data->tanggallahir = \Input::get('tahun') . "-" . \Input::get('bulan') . "-" . \Input::get('tanggal');
         $data->agama = \Input::get('agama');
         $data->jk = \Input::get('jk');
         $data->id_ortu = \Input::get('id_ortu');
         $data->save();
         $passortu = Ortu::where('id', '=', \Input::get('id_ortu'))->first();
         $passortu = $passortu->password;
         $pengguna = new UsersModel();
         $pengguna->username = \Input::get('nisn');
         $pengguna->password = $passortu;
         $pengguna->group_id = "4";
         $pengguna->save();
         return \Redirect::to('siswa');
     } else {
         return \Redirect::to('login');
     }
 }
예제 #2
0
 public function delete($id)
 {
     if (Auth::check()) {
         Ortu::find($id)->delete();
         return \Redirect::to('ortu');
     } else {
         return \Redirect::to('login');
     }
 }