public function search()
 {
     $kata_kunci = Request::input('kata_kunci');
     $employees = employees::where('nama', 'like', '%' . $kata_kunci . '%')->orWhere('nip', 'like', '%' . $kata_kunci . '%')->orWhere('unit_kerja', 'like', '%' . $kata_kunci . '%')->paginate(9);
     $employees->setPath('search');
     return View('books.search')->with('employees', $employees);
 }
 public function import()
 {
     set_time_limit(3000);
     $results = Excel::load('public/uploads/DataPegawai.xls')->get();
     foreach ($results as $row) {
         employees::updateOrCreate(['id' => $row->id, 'nip' => $row->nip], ['no_karpeg' => $row->no_karpeg, 'nama' => $row->nama, 'jenis_kelamin' => $row->jenis_kelamin, 'agama' => $row->agama, 'tempat_lahir' => $row->tempat_lahir, 'tanggal_lahir' => $row->tanggal_lahir, 'tmt_cpns' => $row->tmt_cpns, 'tmt_pns' => $row->tmt_pns, 'tmt_pangkat_terakhir' => $row->tmt_pangkat_terakhir, 'pangkat' => $row->pangkat, 'golongan' => $row->golongan, 'jabatan' => $row->jabatan, 'unit_kerja' => $row->unit_kerja, 'instansi' => $row->instasi, 'pendidikan_terakhir' => $row->pendidikan_terakhir, 'pendidikan_tahun_lulus' => $row->pendidikan_tahun_lulus, 'pendidikan_univ' => $row->pendidikan_univ, 'pendidikan_tempat' => $row->pendidikan_tempat, 'pendidikan_jurusan' => $row->pendidikan_jurusan, 'status' => $row->status]);
     }
 }
 public function search()
 {
     $kata_kunci = Request::input('kata_kunci');
     if ($kata_kunci == '') {
         \Session::Flash('error', 'Keywords tidak boleh kosong');
         return redirect('/getData');
     } else {
         $employees = employees::where('nama', 'like', '%' . $kata_kunci . '%')->orWhere('nip', 'like', '%' . $kata_kunci . '%')->orWhere('unit_kerja', 'like', '%' . $kata_kunci . '%')->paginate(9);
         $employees->setPath('search');
         return View('books.search')->with('employees', $employees);
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     employees::find($id)->delete();
     \Session::flash('flash_message', 'Data pegawai telah dihapus');
     return Redirect::route('employees');
 }