From 79dfbd79a3fb73eb292dffb59b8ffa8030830d88 Mon Sep 17 00:00:00 2001 From: Baghiz Zuhdi Adzin <74885652+baghizzhd@users.noreply.github.com> Date: Thu, 22 Jan 2026 08:47:54 +0700 Subject: [PATCH] fix payment bug --- .../student/VAPaymentController.php | 26 +++++++++---------- routes/student.php | 12 ++++----- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/Http/Controllers/student/VAPaymentController.php b/app/Http/Controllers/student/VAPaymentController.php index 3bddc9d..f5d0f9c 100644 --- a/app/Http/Controllers/student/VAPaymentController.php +++ b/app/Http/Controllers/student/VAPaymentController.php @@ -282,20 +282,20 @@ class VAPaymentController extends Controller $finalAmount - $history['instructor_revenue']; } - // Payment_history::insert($history); + Payment_history::insert($history); - // // 3️⃣ Enrollment - // Enrollment::insert([ - // 'user_id' => $payment->user_id, - // 'course_id' => $course->id, - // 'enrollment_type' => 'paid', - // 'entry_date' => time(), - // 'expiry_date' => $course->expiry_period > 0 - // ? strtotime('+' . ($course->expiry_period * 30) . ' days') - // : null, - // 'created_at' => now(), - // 'updated_at' => now(), - // ]); + // 3️⃣ Enrollment + Enrollment::insert([ + 'user_id' => $payment->user_id, + 'course_id' => $course->id, + 'enrollment_type' => 'paid', + 'entry_date' => time(), + 'expiry_date' => $course->expiry_period > 0 + ? strtotime('+' . ($course->expiry_period * 30) . ' days') + : null, + 'created_at' => now(), + 'updated_at' => now(), + ]); } } diff --git a/routes/student.php b/routes/student.php index 2377250..947e179 100644 --- a/routes/student.php +++ b/routes/student.php @@ -145,18 +145,18 @@ Route::middleware(['auth'])->group(function () { Route::post('tutor-review', 'tutor_review')->name('tutor_review'); }); -}); - -Route::middleware('auth')->group(function () { - //Certificate download - Route::get('certificate/{identifier}', [HomeController::class, 'download_certificate'])->name('certificate'); - // offline payment + // offline payment Route::post('payment/offline/store', [OfflinePaymentController::class, 'store'])->name('payment.offline.store'); // offline payment Route::post('payment/va/store', [VAPaymentController::class, 'store'])->name('payment.va.store'); Route::get('payment/va/{id}', [VAPaymentController::class, 'show'])->name('payment.va.show'); Route::get('/payment/va/{id}/status', [VAPaymentController::class, 'checkPaymentApi'])->name('payment.va.status'); + }); +//Certificate download +Route::get('certificate/{identifier}', [HomeController::class, 'download_certificate'])->name('certificate')->withoutMiddleware(['verified']); + +