fadlyshafa

Untitled

Apr 17th, 2020
318
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function import(Request $request){
  2.         try {
  3.             $file = $request->file('dokumen');
  4.  
  5.             $extenseion = $file->getClientOriginalExtension();
  6.             // dd($extenseion);
  7.             $nama_file = date('YmdHis').'.'.$extenseion;
  8.            
  9.             $file->storeAs('uploads',$nama_file);
  10.  
  11.             // dd();
  12.             Excel::import(new ProdukImport, storage_path('app/uploads/'.$nama_file));
  13.             \Session::flash('sukses','Data berhasil diimport');
  14.         } catch (\Exception $e) {
  15.             \Session::flash('gagal',$e->getMessage());
  16.         }
  17.        
  18.         return redirect('/produk');
  19.     }
RAW Paste Data