fix va bayar

parent f79abb5b
......@@ -18,14 +18,18 @@
class RegistrasiController extends Controller
{
public function create(){
// $jumlahPendaftar = Registrasi::count();
// $nourut = sprintf("%05s", $jumlahPendaftar+1);
// $koderegistrasi = 'REG-'.$komponen[0].$komponen[1].$komponen[2].$nourut;
$kegiatan = Kegiatan::get();
$konferensi = Konferensi::get();
$jumlahPendaftar = Registrasi::count();
$nourut = sprintf("%05s", $jumlahPendaftar+1);
$date = Date('Y-m-d');
$lastKode = Registrasi::query()->whereDate('created_at', $date)->max('kode_registrasi');
$nourut = sprintf("%05s", substr($lastKode, -5)+1);
$tgldaftar = Carbon::now()->format('d-m-Y');
$komponen = explode('-', $tgldaftar);
// $koderegistrasi = 'REG-'.$komponen[0].$komponen[1].$komponen[2].$nourut;
$koderegistrasi = $komponen[0].$komponen[1].$nourut;
$koderegistrasi = '-';
$data = [
'kegiatan' => $kegiatan,
......@@ -54,6 +58,13 @@ public function store(Request $request) {
DB::beginTransaction();
try{
$date = Date('Y-m-d');
$lastKode = Registrasi::query()->whereDate('created_at', $date)->max('kode_registrasi');
$nourut = sprintf("%05s", substr($lastKode, -5)+1);
$tgldaftar = Carbon::now()->format('d-m-Y');
$komponen = explode('-', $tgldaftar);
$kode_registrasi = $komponen[0].$komponen[1].$nourut;
$registrasi = [
'nama' => strip_tags($request->nama),
'email' => strip_tags($request->email),
......@@ -63,7 +74,7 @@ public function store(Request $request) {
'alamat' => strip_tags($request->alamat),
'kode_pos' => strip_tags($request->kodepos),
'kota' => strip_tags($request->kota),
'kode_registrasi' => strip_tags($request->kode_registrasi)
'kode_registrasi' => strip_tags($kode_registrasi)
];
$tglRegistrasi = Carbon::now()->format('Y-m-d h:i:s');
......@@ -72,7 +83,6 @@ public function store(Request $request) {
$konaspi = Kegiatan::query()->where('id', '498633a9-082c-4a4a-9dbd-e20b678ec15e')->first();
$registrasi = Registrasi::query()->create($registrasi);
$id_registrasi = $registrasi->id;
$kode_registrasi = $registrasi->kode_registrasi;
//inisial harga
// dd($konaspi);
$totalHarga = (int) $konaspi->harga;
......@@ -110,6 +120,8 @@ public function store(Request $request) {
$arrResponse = json_decode($generatedVa, true);
$registrasi->status_va = $arrResponse['BTNresponse'];
$registrasi->tagihan = $totalHarga;
$registrasi->save();
if($arrResponse['BTNresponse'] != 'Request has been processed successfully'){
......
......@@ -70,7 +70,7 @@
|
*/
'timezone' => 'UTC',
'timezone' => 'Asia/Jakarta',
/*
|--------------------------------------------------------------------------
......@@ -83,7 +83,7 @@
|
*/
'locale' => 'en',
'locale' => 'id',
/*
|--------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment