app/Http/Controllers/KaryawanController.php
/**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
Show the form for creating a new resource.
@return \Illuminate\Http\Response
Show the form for creating a new resource . @return \ Illuminate \ Http \ Response
public function create(Request $req)
    {
        $karyawans= new karyawan;
        $karyawans->nama = $req->nama;
        $karyawans->nik = $req->nik;
        $karyawans->no_npwp = $req->no_npwp;
        $karyawans->no_bpjs_ketenagakerjaan = $req->no_bpjs_ketenagakerjaan;
        $karyawans->no_bpjs_kesehatan = $req->no_bpjs_kesehatan;
        $karyawans->tanggal_lahir = $req->tanggal_lahir;
        $karyawans->wilayah_id = $req->wilayah_id;
        $karyawans->unit_kerja_id = $req->unit_kerja_id;
        $karyawans->bidang_tugas = $req->bidang_tugas;
        $karyawans->pendidikan_formal = $req->pendidikan_formal;
        $karyawans->honor = $req->honor;
        $karyawans->no_telp = $req->no_telp;
        $karyawans->jenis_kelamin = $req->jenis_kelamin;
        $karyawans->alamat_domisili = $req->alamat_domisili;
        $karyawans->alamat_ktp = $req->alamat_ktp;
        $karyawans->foto_karyawan = $req->foto_karyawan;
        $karyawans->foto_ktp = $req->foto_ktp;
        $karyawans->perjanjian_kerja = $req->perjanjian_kerja;
        $karyawans->kontrak = $req->kontrak;
        $karyawans->vaksin = $req->vaksin;
        $karyawans->no_rekening = $req->no_rekening;
        $karyawans->nama_bank = $req->nama_bank;
        $karyawans->vaksin = $req->vaksin;
        $foto = $req->file('file_ktp')->getClientOriginalName();
        $karyawans->foto_ktp = $req->file('file_ktp')->move(public_path('uploads'),$foto);
        $foto_karyawan = $req->file('file_karyawan')->getClientOriginalName();
        $karyawans->foto_karyawan = $req->file('file_karyawan')->move(public_path('uploads'),$foto_karyawan);
        $query = $karyawans->save();
        if ($query) {
            return redirect('/karyawan');
        }else{
            return back();
        }
    }
public function create ( Request $ req ) { $ karyawans = new karyawan ; $ karyawans -> nama = $ req -> nama ; $ karyawans -> nik = $ req -> nik ; $ karyawans -> no_npwp = $ req -> no_npwp ; $ karyawans -> no_bpjs_ketenagakerjaan = $ req -> no_bpjs_ketenagakerjaan ; $ karyawans -> no_bpjs_kesehatan = $ req -> no_bpjs_kesehatan ; $ karyawans -> tanggal_lahir = $ req -> tanggal_lahir ; $ karyawans -> wilayah_id = $ req -> wilayah_id ; $ karyawans -> unit_kerja_id = $ req -> unit_kerja_id ; $ karyawans -> bidang_tugas = $ req -> bidang_tugas ; $ karyawans -> pendidikan_formal = $ req -> pendidikan_formal ; $ karyawans -> honor = $ req -> honor ; $ karyawans -> no_telp = $ req -> no_telp ; $ karyawans -> jenis_kelamin = $ req -> jenis_kelamin ; $ karyawans -> alamat_domisili = $ req -> alamat_domisili ; $ karyawans -> alamat_ktp = $ req -> alamat_ktp ; $ karyawans -> foto_karyawan = $ req -> foto_karyawan ; $ karyawans -> foto_ktp = $ req -> foto_ktp ; $ karyawans -> perjanjian_kerja = $ req -> perjanjian_kerja ; $ karyawans -> kontrak = $ req -> kontrak ; $ karyawans -> vaksin = $ req -> vaksin ; $ karyawans -> no_rekening = $ req -> no_rekening ; $ karyawans -> nama_bank = $ req -> nama_bank ; $ karyawans -> vaksin = $ req -> vaksin ; $ foto = $ req -> file ( 'file_ktp' ) -> getClientOriginalName ( ) ; $ karyawans -> foto_ktp = $ req -> file ( 'file_ktp' ) -> move ( public_path ( 'uploads' ) , $ foto ) ; $ foto_karyawan = $ req -> file ( 'file_karyawan' ) -> getClientOriginalName ( ) ; $ karyawans -> foto_karyawan = $ req -> file ( 'file_karyawan' ) -> move ( public_path ( 'uploads' ) , $ foto_karyawan ) ; $ query = $ karyawans -> save ( ) ; if ( $ query ) { return redirect ( '/karyawan' ) ; } else { return back ( ) ; } }
Show the form for creating a new resource.
Show the form for creating a new resource .