Esempio n. 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id, $idtransaksi)
 {
     $debitur = Debitur::findOrFail($id);
     $transaksi = Transaksi::findOrFail($idtransaksi);
     $idmotor = $request->input('motor_id');
     $motor = Motor::findOrFail($idmotor);
     $input = $request->all();
     $input = ['kode' => $request->input('kode'), 'debitur_id' => $request->input('debitur_id'), 'motor_id' => $request->input('motor_id'), 'uangmuka' => $request->input('uangmuka'), 'tempo' => $request->input('tempo'), 'angsuran' => ($motor->harga - $request->input('uangmuka')) / $request->input('tempo'), 'no_polisi' => $request->input('no_polisi'), 'no_mesin' => $request->input('no_mesin'), 'no_rangka' => $request->input('no_rangka'), 'penyerah' => $request->input('penyerah'), 'penerima' => $request->input('penerima')];
     $transaksi->update($input);
     return redirect('admin/debitur/' . $id);
 }
Esempio n. 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Debitur::findOrFail($id)->delete();
     return Redirect::route('admin.debitur.index');
 }