update function hapus marhun
This commit is contained in:
@@ -1347,6 +1347,8 @@ class MarhunController extends Controller
|
||||
if ($request->jenis_button == 'terima') {
|
||||
foreach ($pengesahan as $terimalel) {
|
||||
$lelongbidmarhuns = LelongBidMarhun::where('lelongbidmarhun.id', $terimalel['lelongbidmarhun_id'])->first();
|
||||
$semakCount = LelongBidMarhun::where('lelongbidmarhun.id', $terimalel['lelongbidmarhun_id'])->get();
|
||||
$bilmarhun = $semakCount->count();
|
||||
// dd($lelongbidmarhuns);
|
||||
|
||||
// foreach ($lelongbidmarhuns as $bidmarhuns) {
|
||||
@@ -1561,28 +1563,46 @@ class MarhunController extends Controller
|
||||
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
|
||||
$bilmarhun = LelongBidMarhun::join('lelongbid', 'lelongbidmarhun.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('lelongbid.id', $request->lelongbid_id)
|
||||
->get();
|
||||
$semakCount1 = $bilmarhun->count();
|
||||
|
||||
$marhun = LelongBidMarhun::join('lelongbid', 'lelongbidmarhun.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('lelongbidmarhun.id', '=', $request->lelongbidmarhun_id)
|
||||
->where('lelongbid.id', $request->lelongbid_id)
|
||||
->first();
|
||||
$bilmarhunpengesahan = Pengesahan::where('pengesahan.lelongbid_id', $request->lelongbid_id)
|
||||
->get();
|
||||
$semakCount2 = $bilmarhunpengesahan->count();
|
||||
// dd($semakCount1, $semakCount2, $semakCount2 >= $semakCount1-1);
|
||||
|
||||
$id = $request->lelongbid_id;
|
||||
$lelong_id = $marhun->lelong_id;
|
||||
if($semakCount2 >= $semakCount1-1){
|
||||
|
||||
return redirect()
|
||||
->route('marhun.show', compact('id', 'lelong_id'))
|
||||
->with('failed', 'Item Marhun Tidak Boleh Hapus Semua');
|
||||
}else{
|
||||
|
||||
$pengesahan = new Pengesahan();
|
||||
$pengesahan->lelong_id = $marhun->lelong_id;
|
||||
$pengesahan->lelongbid_id = $request->lelongbid_id;
|
||||
$pengesahan->lelongbidmarhun_id = $request->lelongbidmarhun_id;
|
||||
$pengesahan->norujukan = $marhun->norujukan;
|
||||
$pengesahan->diminta_oleh = $user->id;
|
||||
$pengesahan->diminta_pada = $currentdate;
|
||||
$pengesahan->status_ubah = 3;
|
||||
$pengesahan->save();
|
||||
$marhun = LelongBidMarhun::join('lelongbid', 'lelongbidmarhun.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('lelongbidmarhun.id', '=', $request->lelongbidmarhun_id)
|
||||
->where('lelongbid.id', $request->lelongbid_id)
|
||||
->first();
|
||||
|
||||
return redirect()
|
||||
->route('marhun.show', compact('id', 'lelong_id'))
|
||||
->with('success', 'Permohonan Pengesahan Padam Marhun Telah Berjaya Dihantar');
|
||||
$id = $request->lelongbid_id;
|
||||
$lelong_id = $marhun->lelong_id;
|
||||
|
||||
$pengesahan = new Pengesahan();
|
||||
$pengesahan->lelong_id = $marhun->lelong_id;
|
||||
$pengesahan->lelongbid_id = $request->lelongbid_id;
|
||||
$pengesahan->lelongbidmarhun_id = $request->lelongbidmarhun_id;
|
||||
$pengesahan->norujukan = $marhun->norujukan;
|
||||
$pengesahan->diminta_oleh = $user->id;
|
||||
$pengesahan->diminta_pada = $currentdate;
|
||||
$pengesahan->status_ubah = 3;
|
||||
$pengesahan->save();
|
||||
|
||||
return redirect()
|
||||
->route('marhun.show', compact('id', 'lelong_id'))
|
||||
->with('success', 'Permohonan Pengesahan Padam Marhun Telah Berjaya Dihantar');
|
||||
}
|
||||
}
|
||||
|
||||
public function senarailelong()
|
||||
|
||||
Reference in New Issue
Block a user