update lelong
This commit is contained in:
@@ -27,6 +27,7 @@ use App\Models\LelongBidder;
|
||||
use App\Models\LelongBidMarhun;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\LelKarat_temp;
|
||||
use App\Models\Resit;
|
||||
use Carbon\Carbon;
|
||||
|
||||
|
||||
@@ -436,6 +437,13 @@ class LelongController extends Controller
|
||||
|
||||
public function janapemenang($id){
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
$day = $current->day;
|
||||
$month = $current->month;
|
||||
$year = $current->format('y');
|
||||
|
||||
$lelong = Lelong::where('id','=',$id)->first();
|
||||
$lelongbid = LelongBid::where('lelong_id','=',$id)->get();
|
||||
foreach($lelongbid as $bid)
|
||||
@@ -461,6 +469,24 @@ class LelongController extends Controller
|
||||
$updatebid->nopembeli = $bidder->user_id;
|
||||
$updatebid->status_jual = 1;
|
||||
$updatebid->save();
|
||||
|
||||
$previous_siri = Resit::orderBy('id','desc')->first();
|
||||
if($previous_siri){
|
||||
$nosiri = $previous_siri->id + 1;
|
||||
}else{
|
||||
$nosiri = 1;
|
||||
}
|
||||
|
||||
$reference_no = 'LPKB' . $day . $month . $year . sprintf("%08d", $nosiri);
|
||||
|
||||
$resit = new Resit;
|
||||
$resit->user_id = $bidder->user_id;
|
||||
$resit->lelongbid_id = $bid->id;
|
||||
$resit->reference_no = $reference_no;
|
||||
$resit->billplz_id = '';
|
||||
$resit->total_payment = $bidder->hargabida;
|
||||
$resit->resit_type = 2; // 1 = fee , 2 = bid
|
||||
$resit->save();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user