Merge branch 'faiqahzaman'
This commit is contained in:
@@ -11,6 +11,7 @@ use App\Models\LelongBidMarhun;
|
||||
use App\Models\lelkarat;
|
||||
use App\Models\User;
|
||||
use App\Models\Payment;
|
||||
use App\Models\Cart;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Cawangan;
|
||||
|
||||
@@ -61,43 +62,44 @@ class LelongMobileController extends Controller
|
||||
|
||||
public function bidderSelectBidItem(Request $request){
|
||||
|
||||
$post_data = $request->all();
|
||||
if (isset($post_data['user_token'])) {
|
||||
[$id, $user_token] = explode('|', $post_data['user_token'], 2);
|
||||
$token_data = DB::table('personal_access_tokens')->where('token', hash('sha256', $partner_token))->first();
|
||||
$user_id = $user_id->tokenable_id; // !!!THIS ID WE CAN USE TO GET DATA OF YOUR USER!!!
|
||||
}
|
||||
// $feepayment = Payment::select('status')
|
||||
// ->where('status', 1)
|
||||
// ->first();
|
||||
|
||||
$feepayment = payment::where('status', $status == 1)->first();
|
||||
$feepayment = Payment::where('status', '=', 1)->first();
|
||||
|
||||
if($feepayment != null){
|
||||
|
||||
$selectBid = Lelong::join('lelongbid', 'lelong.id', '=', 'lelongbid.lelong_id')
|
||||
->join('cart', 'lelongbid.id', '=', 'cart.lelongbid_id')
|
||||
->where('norujukan', $request->norujukan)
|
||||
$user = User::where('id', '=', $request->user_id)
|
||||
->first();
|
||||
|
||||
$selectBid = Cart::join('lelongbid', 'carts.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('lelongbid.norujukan', $request->norujukan)
|
||||
->select('lelongbid.id as lelongbid_id',
|
||||
'lelongbid.t_lelong',
|
||||
'lelongbid.nilaimarhun',
|
||||
'lelongbid.cajlelong',
|
||||
'cart.hargabida')
|
||||
'carts.hargabida')
|
||||
->get();
|
||||
|
||||
// dd($selectBid[0]->hargabida);
|
||||
|
||||
$currentdate = Carbon::now()->toDateTimeString();
|
||||
|
||||
$lelongBidder = new LelongBidder();
|
||||
$lelongBidder->nama_bidder = $fields['nama_bidder'];
|
||||
$lelongBidder->hargabida = $selectBid;
|
||||
$lelongBidder->t_lelong = $selectBid;
|
||||
$lelongBidder->lelongbid_id = $selectBid;
|
||||
$lelongBidder->nilaimarhun = $selectBid;
|
||||
$lelongBidder->cajlelong = $selectBid;
|
||||
$lelongBidder->status_bidder = $fields['status_bidder'];
|
||||
$lelongBidder->status_payment = $fields['status_payment'];
|
||||
$lelongBidder->nama_bidder = $request->name;
|
||||
$lelongBidder->user_id = $user->id;
|
||||
$lelongBidder->notelbimbit = $user->notelbimbit;
|
||||
$lelongBidder->hargabida = $selectBid[0]->hargabida;
|
||||
$lelongBidder->lelongbid_id = $selectBid[0]->lelongbid_id;
|
||||
$lelongBidder->nilaimarhun = $selectBid[0]->nilaimarhun;
|
||||
$lelongBidder->cajlelong = $selectBid[0]->cajlelong;
|
||||
$lelongBidder->masa_bidaan = $currentdate;
|
||||
$lelongBidder->save();
|
||||
|
||||
return response()->json("success", 201);
|
||||
}
|
||||
else if($status == null){
|
||||
else if($feepayment == null){
|
||||
return response()->json("unsuccess", 201);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class lelongBidder extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'lelongbid';
|
||||
protected $table = 'lelongbidder';
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
|
||||
@@ -9,7 +9,7 @@ class payment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'lelongbid';
|
||||
protected $table = 'payment';
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
|
||||
@@ -9,7 +9,7 @@ class resit extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'lelongbid';
|
||||
protected $table = 'resit';
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
|
||||
@@ -22,8 +22,8 @@ class CreateLelongbidderTable extends Migration
|
||||
$table->string('notelbimbit');
|
||||
$table->decimal('nilaimarhun');
|
||||
$table->decimal('cajlelong');
|
||||
$table->integer('status_bidder')->nullable();
|
||||
$table->integer('status_payment')->nullable();
|
||||
$table->integer('status_bidder')->nullable(); //1 = win
|
||||
$table->integer('status_payment')->nullable(); // 1=paid
|
||||
$table->datetime('masa_bidaan');
|
||||
$table->timestamps();
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ class CreatePaymentTable extends Migration
|
||||
$table->string('reference_no')->nullable();
|
||||
$table->string('billplz_id');
|
||||
$table->decimal('total_payment', $precision = 9, $scale = 2);
|
||||
$table->string('resit_type');
|
||||
$table->string('status')->nullable();
|
||||
$table->string('resit_type'); // 1 = fee , 2 = bid
|
||||
$table->string('status')->nullable(); //status => 1 = paid , 2 = pending
|
||||
$table->timestamp('paid_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user