update kemaskiniLelong job, add xlaku, add owner bidder
This commit is contained in:
@@ -59,7 +59,11 @@ class kemaskiniLelong extends Command
|
||||
if($gadai->sttebus == 'T'){
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'T';
|
||||
}else{
|
||||
}elseif($gadai->sttebus == 'L'){
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'L';
|
||||
}
|
||||
else{
|
||||
$telahbayar = $gadai->hargajualan - $gadai->bakihargajualan;
|
||||
$upah6bln_raw = $gadai->bakiupah - 0.5;
|
||||
if(bcdiv($telahbayar,1,1) >= bcdiv($upah6bln_raw,1,1)){
|
||||
@@ -87,16 +91,24 @@ class kemaskiniLelong extends Command
|
||||
}
|
||||
|
||||
}
|
||||
$lelongbid->jbg = $gadai->tempoh;
|
||||
$lelongbid->pinjaman = $gadai->bakipjm;
|
||||
$lelongbid->bakiupah = $keuntungan;
|
||||
$lelongbid->save();
|
||||
$checkdataxlaku = LelongBid::where('norujukan', $lelongbid->norujukan)
|
||||
->where('xlaku', 1)
|
||||
->first();
|
||||
if (!$checkdataxlaku) {
|
||||
$lelongbid->jbg = $gadai->tempoh;
|
||||
$lelongbid->pinjaman = $gadai->bakipjm;
|
||||
$lelongbid->bakiupah = $keuntungan;
|
||||
$lelongbid->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if($gadai->sttebus == 'T'){
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'T';
|
||||
}elseif($gadai->sttebus == 'L'){
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'L';
|
||||
}else{
|
||||
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan',$lelongbid->norujukan)->sum('keuntungan_rebet');
|
||||
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan',$lelongbid->norujukan)->sum('bayaran_keuntungan');
|
||||
@@ -116,10 +128,15 @@ class kemaskiniLelong extends Command
|
||||
$keuntungan = bcdiv(($jbg2)*$gadai->kadarupah/100*$gadai->bakipjm,1,1)-$beza_keuntungan;
|
||||
}
|
||||
}
|
||||
$lelongbid->jbg = $gadai->tempoh;
|
||||
$lelongbid->pinjaman = $gadai->bakipjm;
|
||||
$lelongbid->bakiupah = $keuntungan;
|
||||
$lelongbid->save();
|
||||
$checkdataxlaku = LelongBid::where('norujukan', $lelongbid->norujukan)
|
||||
->where('xlaku', 1)
|
||||
->first();
|
||||
if (!$checkdataxlaku) {
|
||||
$lelongbid->jbg = $gadai->tempoh;
|
||||
$lelongbid->pinjaman = $gadai->bakipjm;
|
||||
$lelongbid->bakiupah = $keuntungan;
|
||||
$lelongbid->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ use DateTime;
|
||||
// use Nexmo\Laravel\Facade\Nexmo;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Jobs\HantarMail;
|
||||
use App\Jobs\WhatsappPemenang;
|
||||
|
||||
class LelongController extends Controller
|
||||
{
|
||||
@@ -2376,16 +2378,46 @@ class LelongController extends Controller
|
||||
$current = $current_default->toDateString();
|
||||
|
||||
$lelong = Lelong::find($lelong_id, ['id', 'cajlelong']);
|
||||
$lelong_bid_all = LelongBid::select('id', 'pinjaman', 'bakiupah')->where('lelong_id', '=', $lelong_id)->where('status_jual', '=', 0)->get();
|
||||
$lelong_bid_all = LelongBid::select('id','norujukan', 'pinjaman', 'bakiupah','kodcaw')
|
||||
->where('lelong_id', '=', $lelong_id)->where('status_jual', '=', 0)->get();
|
||||
|
||||
foreach($lelong_bid_all as $index7=>$gadai){
|
||||
$kodcaw = $gadai->kodcaw;
|
||||
$norujukan = $gadai->norujukan;
|
||||
$datanokp = Gadai::on($kodcaw)->where('norujukan', $norujukan)
|
||||
->select('nokp')
|
||||
->orderBy('norujukan','ASC')
|
||||
->first();
|
||||
$lelong_bid_all[$index7]['nokp_owner'] = $datanokp->nokp;
|
||||
}
|
||||
// dd($lelong_bid_all[$index7]['nokp_owner']);
|
||||
|
||||
$lelong_bid_all_pluck_id = $lelong_bid_all->pluck('id');
|
||||
$lelong_bid_all_key_by_id = $lelong_bid_all->keyBy('id');
|
||||
|
||||
$lelong_bidder_all = LelongBidder::whereIn('lelongbid_id', $lelong_bid_all_pluck_id)
|
||||
->select('id', 'lelongbid_id', 'hargabida', 'user_id')
|
||||
->leftJoin('users','users.id','=','lelongbidder.user_id')
|
||||
->join('lelongbid','lelongbid.id','=','lelongbidder.lelongbid_id')
|
||||
->select('lelongbidder.id', 'lelongbid_id', 'hargabida', 'lelongbidder.user_id','users.nokp','lelongbid.kodcaw','lelongbid.norujukan')
|
||||
->where('masa_bidaan', 'LIKE', '%' . $current . '%')
|
||||
->orderBy('masa_bidaan', 'ASC')
|
||||
->get();
|
||||
// dd($lelong_bidder_all);
|
||||
$lelong_bid_all_key_by_norujukan_2 = $lelong_bid_all->keyBy('norujukan');
|
||||
// dd($lelong_bid_all_key_by_norujukan_2);
|
||||
|
||||
foreach($lelong_bidder_all as $index7=>$lelong_bidder2){
|
||||
// dump(($lelong_bid_all_key_by_norujukan_2[$lelong_bidder2->norujukan]));
|
||||
if($lelong_bid_all_key_by_norujukan_2[$lelong_bidder2->norujukan]){
|
||||
$owner_true = $lelong_bid_all_key_by_norujukan_2[$lelong_bidder2->norujukan];
|
||||
// dump($lelong_bidder2->norujukan, $lelong_bidder2->nokp == $owner_true->nokp_owner);
|
||||
if($lelong_bidder2->nokp == $owner_true->nokp_owner){
|
||||
$lelong_bidder_all[$index7]['owner'] = true;
|
||||
}else{
|
||||
$lelong_bidder_all[$index7]['owner'] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$lelong_bidder_group_by_lelong_bid_id = $lelong_bidder_all->groupBy('lelongbid_id');
|
||||
|
||||
@@ -2393,16 +2425,24 @@ class LelongController extends Controller
|
||||
foreach ($lelong_bidder_group_by_lelong_bid_id as $lelong_bidders) {
|
||||
$bidder_paling_tinggi = new LelongBidder();
|
||||
foreach ($lelong_bidders as $lelong_bidder) {
|
||||
if ($bidder_paling_tinggi->hargabida == null) {
|
||||
if($lelong_bidder->owner == true){
|
||||
$bidder_paling_tinggi = $lelong_bidder;
|
||||
} else {
|
||||
if ($lelong_bidder->hargabida > $bidder_paling_tinggi->hargabida) {
|
||||
$bidder_paling_tinggi = $lelong_bidder;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if($lelong_bidder->owner == false){
|
||||
if($bidder_paling_tinggi->hargabida == null) {
|
||||
$bidder_paling_tinggi = $lelong_bidder;
|
||||
}
|
||||
else {
|
||||
if ($lelong_bidder->hargabida > $bidder_paling_tinggi->hargabida) {
|
||||
$bidder_paling_tinggi = $lelong_bidder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$collection_lelong_bidder_menang->add($bidder_paling_tinggi);
|
||||
}
|
||||
//dd($collection_lelong_bidder_menang);
|
||||
|
||||
$cases_update_caj_lelong = '';
|
||||
$cases_update_baki_lelong = '';
|
||||
@@ -2494,23 +2534,30 @@ class LelongController extends Controller
|
||||
|
||||
$total_bid_win = $pemenang->sum('hargabida');
|
||||
$total_bid_win_converted = number_format($total_bid_win, 2, '.', ',');
|
||||
$user_email = $user_true->email;
|
||||
$user_name = $user_true->name;
|
||||
$user_notelbimbit = $user_true->notelbimbit;
|
||||
|
||||
Mail::to($user_true->email)->send(new Pemenang($user_true->name, $total_bid_win_converted));
|
||||
HantarMail::dispatch($user_email, $user_name, $total_bid_win_converted);
|
||||
|
||||
$mobile_no = ltrim($user_true->notelbimbit, '+');
|
||||
$message = 'AR-RAHN PKB: Tahniah Anda Menang Bidaan Sebanyak RM' . $total_bid_win_converted . '. Sila Semak Melalui Sistem ArrahnBid. Terima Kasih.';
|
||||
if(config('app.env') != 'production'){
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
$response = Http::get(env('WABOT_API'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => $message,
|
||||
'instance_id' => env('WABOT_INSTANCES_ID'),
|
||||
'access_token' => env('WABOT_TOKEN_KEYS')
|
||||
]);
|
||||
// Mail::to($user_true->email)->send(new Pemenang($user_true->name, $total_bid_win_converted));
|
||||
|
||||
Log::info("WABOT - menang bidaan " . $response);
|
||||
//$mobile_no = ltrim($user_notelbimbit, '+');
|
||||
// $message = 'AR-RAHN PKB: Tahniah Anda Menang Bidaan Sebanyak RM' . $total_bid_win_converted . '. Sila Semak Melalui Sistem ArrahnBid. Terima Kasih.';
|
||||
// if(config('app.env') != 'production'){
|
||||
// $mobile_no = config('app.admin_phone_number');
|
||||
// }
|
||||
// $response = Http::get(env('WABOT_API'), [
|
||||
// 'number' => $mobile_no,
|
||||
// 'type' => 'text',
|
||||
// 'message' => $message,
|
||||
// 'instance_id' => env('WABOT_INSTANCES_ID'),
|
||||
// 'access_token' => env('WABOT_TOKEN_KEYS')
|
||||
// ]);
|
||||
|
||||
WhatsappPemenang::dispatch($user_notelbimbit, $total_bid_win_converted);
|
||||
|
||||
// Log::info("WABOT - menang bidaan " . $response);
|
||||
}
|
||||
|
||||
Invoice::insert($invoice_array);
|
||||
@@ -3537,12 +3584,16 @@ class LelongController extends Controller
|
||||
// dd($datalelbid);
|
||||
foreach($data_chunk as $data)
|
||||
{
|
||||
$savedata = $data->replicate();
|
||||
$savedata->setTable('lelongbid_xlaku');
|
||||
$savedata->save();
|
||||
//dd($simulasi->id);
|
||||
$caw_lelsag = LelongBid::where('norujukan', $data->norujukan)
|
||||
->where('status_jual','=', 0)->first();
|
||||
// dd($caw_lelsag);
|
||||
$caw_lelsag->lelong_id = $lelong1->id;
|
||||
$caw_lelsag->t_lelong = $request->tarikhlelongbaru;
|
||||
$caw_lelsag->xlaku = '1';
|
||||
$caw_lelsag->update();
|
||||
|
||||
}
|
||||
@@ -7703,6 +7754,162 @@ class LelongController extends Controller
|
||||
}
|
||||
|
||||
|
||||
public function janapemenangallcaw22($lelong_id)
|
||||
{
|
||||
|
||||
$current_default = new Carbon();
|
||||
$day = $current_default->day;
|
||||
$month = $current_default->month;
|
||||
$year = $current_default->format('y');
|
||||
$current = $current_default->toDateString();
|
||||
|
||||
$lelong = Lelong::find($lelong_id, ['id', 'cajlelong']);
|
||||
$lelong_bid_all = LelongBid::select('id', 'pinjaman', 'bakiupah')->where('lelong_id', '=', $lelong_id)->where('status_jual', '=', 0)->get();
|
||||
|
||||
$lelong_bid_all_pluck_id = $lelong_bid_all->pluck('id');
|
||||
$lelong_bid_all_key_by_id = $lelong_bid_all->keyBy('id');
|
||||
|
||||
$lelong_bidder_all = LelongBidder::whereIn('lelongbid_id', $lelong_bid_all_pluck_id)
|
||||
->select('id', 'lelongbid_id', 'hargabida', 'user_id')
|
||||
->where('masa_bidaan', 'LIKE', '%' . $current . '%')
|
||||
->orderBy('masa_bidaan', 'ASC')
|
||||
->get();
|
||||
|
||||
$lelong_bidder_group_by_lelong_bid_id = $lelong_bidder_all->groupBy('lelongbid_id');
|
||||
|
||||
$collection_lelong_bidder_menang = collect();
|
||||
foreach ($lelong_bidder_group_by_lelong_bid_id as $lelong_bidders) {
|
||||
$bidder_paling_tinggi = new LelongBidder();
|
||||
foreach ($lelong_bidders as $lelong_bidder) {
|
||||
if ($bidder_paling_tinggi->hargabida == null) {
|
||||
$bidder_paling_tinggi = $lelong_bidder;
|
||||
} else {
|
||||
if ($lelong_bidder->hargabida > $bidder_paling_tinggi->hargabida) {
|
||||
$bidder_paling_tinggi = $lelong_bidder;
|
||||
}
|
||||
}
|
||||
}
|
||||
$collection_lelong_bidder_menang->add($bidder_paling_tinggi);
|
||||
}
|
||||
|
||||
$cases_update_caj_lelong = '';
|
||||
$cases_update_baki_lelong = '';
|
||||
$cases_update_harga_jual = '';
|
||||
$cases_update_t_jual = '';
|
||||
$cases_update_no_pembeli = '';
|
||||
$cases_update_status_jual = '';
|
||||
$lelong_bid_array = [];
|
||||
|
||||
foreach ($collection_lelong_bidder_menang as $lel_bidder_menang) {
|
||||
array_push($lelong_bid_array, $lel_bidder_menang->lelongbid_id);
|
||||
if ($lelong_bid_all_key_by_id[$lel_bidder_menang->lelongbid_id]) {
|
||||
$lel_bid_true = $lelong_bid_all_key_by_id[$lel_bidder_menang->lelongbid_id];
|
||||
|
||||
$caj_lelong_bid = $lel_bidder_menang->hargabida * ($lelong->cajlelong / 100);
|
||||
$caj_lelong_bid = round($caj_lelong_bid, 1 ,1);
|
||||
$baki_lelong_bid = $lel_bidder_menang->hargabida - $lel_bid_true->pinjaman - bcdiv($lel_bid_true->bakiupah, 1, 1) - $caj_lelong_bid;
|
||||
|
||||
$cases_update_caj_lelong .= sprintf(' WHEN id = %d THEN %s ', $lel_bid_true->id, $caj_lelong_bid);
|
||||
$cases_update_baki_lelong .= sprintf(' WHEN id = %d THEN %s ', $lel_bid_true->id, $baki_lelong_bid);
|
||||
$cases_update_harga_jual .= sprintf(' WHEN id = %d THEN %s ', $lel_bid_true->id, $lel_bidder_menang->hargabida);
|
||||
$cases_update_t_jual .= sprintf(' WHEN id = %d THEN \'%s\' ', $lel_bid_true->id, $current);
|
||||
$cases_update_no_pembeli .= sprintf(' WHEN id = %d THEN %s ', $lel_bid_true->id, $lel_bidder_menang->user_id);
|
||||
$cases_update_status_jual .= sprintf(' WHEN id = %d THEN %s ', $lel_bid_true->id, 1);
|
||||
}
|
||||
}
|
||||
$build_query_update_caj_lelong = sprintf("CASE %s END", $cases_update_caj_lelong);
|
||||
$build_query_update_baki_lelong = sprintf("CASE %s END", $cases_update_baki_lelong);
|
||||
$build_query_update_harga_jual = sprintf("CASE %s END", $cases_update_harga_jual);
|
||||
$build_query_update_t_jual = sprintf("CASE %s END", $cases_update_t_jual);
|
||||
$build_query_update_no_pembeli = sprintf("CASE %s END", $cases_update_no_pembeli);
|
||||
$build_query_update_status_jual = sprintf("CASE %s END", $cases_update_status_jual);
|
||||
|
||||
LelongBid::query()->whereIn('id', $lelong_bid_array)->update(['cajlelong' => DB::raw($build_query_update_caj_lelong)]);
|
||||
LelongBid::query()->whereIn('id', $lelong_bid_array)->update(['baki' => DB::raw($build_query_update_baki_lelong)]);
|
||||
LelongBid::query()->whereIn('id', $lelong_bid_array)->update(['hargajual' => DB::raw($build_query_update_harga_jual)]);
|
||||
LelongBid::query()->whereIn('id', $lelong_bid_array)->update(['t_jual' => DB::raw($build_query_update_t_jual)]);
|
||||
LelongBid::query()->whereIn('id', $lelong_bid_array)->update(['nopembeli' => DB::raw($build_query_update_no_pembeli)]);
|
||||
LelongBid::query()->whereIn('id', $lelong_bid_array)->update(['status_jual' => DB::raw($build_query_update_status_jual)]);
|
||||
|
||||
$cases_update_status_bidder = '';
|
||||
$lelong_bidder_array = [];
|
||||
|
||||
foreach ($lelong_bidder_all as $lel_bidder) {
|
||||
array_push($lelong_bidder_array, $lel_bidder->id);
|
||||
if ($collection_lelong_bidder_menang->contains('id', $lel_bidder->id)) {
|
||||
$cases_update_status_bidder .= sprintf(' WHEN id = %d THEN %s ', $lel_bidder->id, 1);
|
||||
} else {
|
||||
$cases_update_status_bidder .= sprintf(' WHEN id = %d THEN %s ', $lel_bidder->id, 0);
|
||||
}
|
||||
}
|
||||
$build_query_update_status_bidder = sprintf("CASE %s END", $cases_update_status_bidder);
|
||||
|
||||
LelongBidder::query()->whereIn('id', $lelong_bidder_array)->update(['status_bidder' => DB::raw($build_query_update_status_bidder)]);
|
||||
|
||||
$users_bid = $collection_lelong_bidder_menang->pluck('user_id')->unique();
|
||||
$users = User::whereIn('id', $users_bid)->select('id', 'name', 'email', 'notelbimbit')->get()->keyBy('id');
|
||||
|
||||
$collection_pemenang = $collection_lelong_bidder_menang->groupBy('user_id');
|
||||
|
||||
$invoice_array = [];
|
||||
|
||||
$previous_siri = Invoice::select('id')->orderBy('id', 'desc')->first();
|
||||
|
||||
if ($previous_siri) {
|
||||
$nosiri = $previous_siri->id + 1;
|
||||
} else {
|
||||
$nosiri = 1;
|
||||
}
|
||||
|
||||
foreach ($collection_pemenang as $index => $pemenang) {
|
||||
$user_true = $users[$index];
|
||||
|
||||
$reference_no = 'iPKB' . $day . $month . $year . sprintf("%08d", $nosiri);
|
||||
|
||||
$invoice_to_be_inserted = [
|
||||
'user_id' => $user_true->id,
|
||||
'lelong_id' => $lelong_id,
|
||||
'invoice_no' => $reference_no,
|
||||
'total_invoice' => $pemenang->sum('hargabida'),
|
||||
'invoice_type' => 2,
|
||||
'created_at' => $current_default,
|
||||
'updated_at' => $current_default,
|
||||
];
|
||||
|
||||
array_push($invoice_array, $invoice_to_be_inserted);
|
||||
|
||||
$nosiri += 1;
|
||||
|
||||
$total_bid_win = $pemenang->sum('hargabida');
|
||||
$total_bid_win_converted = number_format($total_bid_win, 2, '.', ',');
|
||||
|
||||
Mail::to($user_true->email)->send(new Pemenang($user_true->name, $total_bid_win_converted));
|
||||
|
||||
$mobile_no = ltrim($user_true->notelbimbit, '+');
|
||||
$message = 'AR-RAHN PKB: Tahniah Anda Menang Bidaan Sebanyak RM' . $total_bid_win_converted . '. Sila Semak Melalui Sistem ArrahnBid. Terima Kasih.';
|
||||
if(config('app.env') != 'production'){
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
$response = Http::get(env('WABOT_API'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => $message,
|
||||
'instance_id' => env('WABOT_INSTANCES_ID'),
|
||||
'access_token' => env('WABOT_TOKEN_KEYS')
|
||||
]);
|
||||
|
||||
Log::info("WABOT - menang bidaan " . $response);
|
||||
}
|
||||
|
||||
Invoice::insert($invoice_array);
|
||||
|
||||
$lelong->sts_lelong = 3;
|
||||
$lelong->save();
|
||||
|
||||
return redirect()->route('lelong.senarailelong')->with('success', 'Selesai menjana pemenang');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\Pemenang;
|
||||
|
||||
class HantarMail implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $user_email;
|
||||
public $user_name;
|
||||
protected $total_bid_win_converted;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($user_email, $user_name, $total_bid_win_converted)
|
||||
{
|
||||
$this->user_email = $user_email;
|
||||
$this->user_name = $user_name;
|
||||
$this->total_bid_win_converted = $total_bid_win_converted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Mail::to($this->user_email)->send(new Pemenang($this->user_name, $this->total_bid_win_converted));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
use App\Models\Cawangan;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Notis;
|
||||
use App\Models\NotisBid;
|
||||
use App\Models\Gadai;
|
||||
use App\Models\Customer;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Models\CawanganNotis;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
class WhatsappPemenang implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $user_notelbimbit;
|
||||
public $total_bid_win_converted;
|
||||
// protected $notisid;
|
||||
// protected $cawid;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($user_notelbimbit, $total_bid_win_converted)
|
||||
{
|
||||
$this->user_notelbimbit = $user_notelbimbit;
|
||||
$this->total_bid_win_converted = $total_bid_win_converted;
|
||||
// $this->notisid = $notisid;
|
||||
// $this->cawid = $cawid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$mobile_no = ltrim($this->user_notelbimbit, '+');
|
||||
$message = 'AR-RAHN PKB: Tahniah Anda Menang Bidaan Sebanyak RM' . $this->total_bid_win_converted . '. Sila Semak Melalui Sistem ArrahnBid. Terima Kasih.';
|
||||
if(config('app.env') != 'production'){
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
$response = Http::get(env('WABOT_API'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => $message,
|
||||
'instance_id' => env('WABOT_INSTANCES_ID'),
|
||||
'access_token' => env('WABOT_TOKEN_KEYS')
|
||||
]);
|
||||
|
||||
Log::info("WABOT - menang bidaan " . $response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LelongBidxlaku extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'lelongbid_xlaku';
|
||||
|
||||
protected $fillable = [
|
||||
'lelong_id',
|
||||
'caw_id',
|
||||
'kodcaw',
|
||||
'norujukan',
|
||||
't_lelong',
|
||||
'hargaasas',
|
||||
'hargajual',
|
||||
't_jual',
|
||||
'nopembeli',
|
||||
'jbg',
|
||||
'kadarupah',
|
||||
'upahsimpan',
|
||||
'ansuran',
|
||||
'nilaimarhun',
|
||||
'pinjaman',
|
||||
'bakiupah',
|
||||
'cajlain',
|
||||
'cajlelong',
|
||||
'baki',
|
||||
'berat',
|
||||
'marhun',
|
||||
'percent',
|
||||
'status_jual',
|
||||
'status_payment',
|
||||
'mora_upah',
|
||||
'fasa'
|
||||
];
|
||||
|
||||
public function cawangan()
|
||||
{
|
||||
return $this->belongsTo(Cawangan::class, 'caw_id','id');
|
||||
}
|
||||
|
||||
// public function lelongbidder() {
|
||||
// return $this->hasOne(LelongBidder::class,'lelongbid_id', 'id' );
|
||||
// }
|
||||
|
||||
public function cawanganLelong(){
|
||||
return $this->hasOne(CawanganLelong::class, 'caw_id','caw_id');
|
||||
}
|
||||
|
||||
// public function fileMarhunMain()
|
||||
// {
|
||||
// return $this->hasOne(FileMarhun::class, 'lelongbid_id')->where('photo_type', 1);
|
||||
// }
|
||||
|
||||
// public function fileMarhunMainMany()
|
||||
// {
|
||||
// return $this->hasMany(FileMarhun::class, 'lelongbid_id')->where('photo_type', 1);
|
||||
// }
|
||||
|
||||
// public function lelong()
|
||||
// {
|
||||
// return $this->belongsTo(Lelong::class, 'lelong_id', 'id');
|
||||
// }
|
||||
|
||||
// public function lelongBidMarhun()
|
||||
// {
|
||||
// return $this->hasMany(LelongBidMarhun::class, 'lelongbid_id', 'id');
|
||||
// }
|
||||
|
||||
// public function scanSemakSelesai()
|
||||
// {
|
||||
// return $this->hasMany(ScanSemak::class, 'lelongbid_id', 'id')->whereNotNull('scan_masuk');
|
||||
// }
|
||||
|
||||
// public function pengesahan()
|
||||
// {
|
||||
// return $this->hasMany(Pengesahan::class, 'lelongbid_id', 'id');
|
||||
// }
|
||||
|
||||
// public function payment()
|
||||
// {
|
||||
// return $this->hasOne(Payment::class, 'norujukan', 'norujukan')->where('status', 2);
|
||||
// }
|
||||
|
||||
// public function scanSemakSelesaiJual()
|
||||
// {
|
||||
// return $this->hasMany(ScanSemak::class, 'lelongbid_id', 'id')->whereNotNull('serahkpdpembida');
|
||||
// }
|
||||
|
||||
// public function lelongBidderMenang()
|
||||
// {
|
||||
// return $this->hasOne(LelongBidder::class, 'lelongbid_id', 'id')->where('status_bidder', 1);
|
||||
// }
|
||||
// public function scanjual()
|
||||
// {
|
||||
// return $this->belongsTo(ScanJual::class, 'id', 'lelongbid_id');
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user