コード例 #1
0
 public function store(Request $request)
 {
     //
     $user = new Karyawan();
     $user->nama_karyawan = \Input::get('name');
     $user->id_jkelamin = \Input::get('jkelamin');
     $user->alamat = \Input::get('alamat');
     $tgl = explode("/", \Input::get('tanggal'));
     $user->ttl = \Input::get('tempat') . ", " . $tgl[2] . "-" . $tgl[0] . "-" . $tgl[1];
     $user->username = \Input::get('username');
     $user->email = \Input::get('email');
     $pass = \Input::get('password');
     $user->password = bcrypt($pass);
     $user->id_divisi = \Input::get('divisi');
     $user->id_jabatan = \Input::get('jabatan');
     $user->save();
     return \Redirect::to('admin/karyawan');
 }
コード例 #2
0
 /**
  * Register atau tambah data karyawan.
  *
  * @return integer
  */
 public function store(Request $request)
 {
     //
     if (Auth::check() && Auth::user()->id_karyawan == '1') {
         $user = new Karyawan();
         $user->nama_karyawan = \Input::get('nama');
         $user->id_jkelamin = \Input::get('jkelamin');
         $user->alamat = \Input::get('alamat');
         $tgl = explode("/", \Input::get('tanggal'));
         $user->ttl = \Input::get('tempat') . ", " . $tgl[2] . "-" . $tgl[0] . "-" . $tgl[1];
         $user->username = \Input::get('username');
         $user->email = \Input::get('email');
         $pass = \Input::get('username') . '1234';
         $user->password = bcrypt($pass);
         $user->id_divisi = \Input::get('divisi');
         $user->id_jabatan = \Input::get('jabatan');
         $user->save();
         return \Redirect::to('admin/karyawan');
     } else {
         return view('errors/403');
     }
 }