/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['jumlah' => 'required|numeric'], ['jumlah.required' => 'Jumlah tidak boleh kosong.', 'jumlah.numeric' => 'Input harus angka.']);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator)->withInput();
     }
     $lastId = 1;
     $lastIdDB = Customer::lastCustomerID();
     if ($lastIdDB) {
         $lastId = $lastIdDB->kode + 1;
     }
     $insertData = [];
     for ($i = 0; $i < $request->get('jumlah'); $i++) {
         $code = $i + $lastId;
         array_push($insertData, ['kode' => str_pad($code, 10, '0', STR_PAD_LEFT)]);
     }
     if (Customer::insert($insertData)) {
         return redirect('/customer?type=unregistered')->with('succcess', 'Sukses buat data id pelanggan.');
     }
     return redirect()->back()->withErrors(['failed' => 'Gagal buat data id pelanggan.']);
 }