Merge branch 'faiqahzaman' into azfar_dev

This commit is contained in:
Azfar Arsyad
2022-01-25 14:07:17 +08:00
5 changed files with 110 additions and 8 deletions
@@ -6,8 +6,11 @@ use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Lelong;
use App\Models\LelongBid;
use App\Models\LelongBidder;
use App\Models\LelongBidMarhun;
use App\Models\lelkarat;
use App\Models\User;
use App\Models\Payment;
use Carbon\Carbon;
use App\Models\Cawangan;
@@ -58,6 +61,13 @@ 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::where('fee' == 1)->first();
if($feepayment != null){
@@ -67,26 +77,23 @@ class LelongMobileController extends Controller
->where('norujukan', $request->norujukan)
->select('lelongbid.id as lelongbid_id',
'lelongbid.t_lelong',
'nilaimarhun',
'cajlelong')
'lelongbid.nilaimarhun',
'lelongbid.cajlelong',
'cart.hargabida')
->get();
$currentdate = Carbon::now()->toDateTimeString();
$lelongBidder = new LelongBidder();
$lelongBidder->nama_bidder = $fields['nama_bidder'];
$lelongBidder->hargabida = $fields['hargabida'];
$lelongBidder->nosirilel = $fields['nosirilel'];
$lelongBidder->nopembeli = $fields['nopembeli'];
$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_bidder_win = $fields['status_bidder_win'];
$lelongBidder->status_payment = $fields['status_payment'];
$lelongBidder->masa_bidaan = $currentdate;
$lelongBidder->lelongBidder_type = 2; //type 2 = pembida
$lelongBidder->save();
}
@@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers\AuthMobile;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Lelong;
use App\Models\Users;
class PaymentController extends Controller
{
//
}
@@ -16,7 +16,7 @@ class CreateLelongbidderTable extends Migration
Schema::create('lelongbidder', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->integer('lelongbid_id');
$table->unsignedBigInteger('lelongbid_id')->unsigned();
$table->string('nama_bidder');
$table->decimal('hargabida');
$table->string('notelbimbit');
@@ -31,6 +31,10 @@ class CreateLelongbidderTable extends Migration
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
$table->foreign('lelongbid_id')
->references('id')->on('lelongbid')
->onDelete('cascade');
});
}
@@ -0,0 +1,77 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePaymentTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('payment', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->unsignedBigInteger('lelongbidder_id')->unsigned()->nullable();
$table->unsignedBigInteger('lelongbid_id')->unsigned();
$table->string('kodcaw')->nullable();
$table->decimal('total_payment')->nullable();
$table->string('back_acc_pembeli')->nullable();
$table->string('bank_acc_no_pembeli')->nullable();
$table->string('nama_bank_acc_caw')->nullable();
$table->string('bank_no_acc_caw')->nullable();
$table->integer('status_payment_opt')->nullable();
$table->integer('resit_id');
$table->integer('status'); //1 = fee RM10 , 2 = paybidifwin
$table->string('remark');
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
$table->foreign('lelongbid_id')
->references('id')->on('lelongbid')
->onDelete('cascade');
$table->foreign('lelongbidder_id')
->references('id')->on('lelongbidder')
->onDelete('cascade');
});
Schema::create('resit', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->unsignedBigInteger('lelongbid_id')->unsigned()->nullable();
$table->string('reference_no')->nullable();
$table->integer('billplz_id');
$table->string('total_payment');
$table->string('resit_type');
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
$table->foreign('lelongbid_id')
->references('id')->on('lelongbid')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('payment');
Schema::dropIfExists('resit');
}
}
+1
View File
@@ -40,6 +40,7 @@ Route::group(['middleware' => ['auth:sanctum']], function () {
Route::put('/userUpdate/profile', [UserController::class, 'updateProfileUser']);
Route::get('/lelongDetails/today', [LelongMobileController::class, 'getlelongdetails']);
Route::get('/karat', [LelongMobileController::class, 'getListKarat']);
Route::post('/bidder/biditem', [LelongMobileController::class, 'bidderSelectBidItem']);
});