diff --git a/app/Http/Controllers/CartController.php b/app/Http/Controllers/CartController.php index 9e38cdd..0e0fb26 100644 --- a/app/Http/Controllers/CartController.php +++ b/app/Http/Controllers/CartController.php @@ -111,6 +111,6 @@ public function coupon_check(Request $request){ ); session()->put('cart_details', $coupondata); } - return redirect()->back()->with('success', 'Product added to cart successfully!'); + return redirect()->back()->with('success', 'Coupon Applied successfully!'); } } diff --git a/app/Http/Controllers/Students/DashboardController.php b/app/Http/Controllers/Students/DashboardController.php index 4d1eb1d..f79adf0 100644 --- a/app/Http/Controllers/Students/DashboardController.php +++ b/app/Http/Controllers/Students/DashboardController.php @@ -14,7 +14,7 @@ class DashboardController extends Controller public function index() { $student_info = Student::find(currentUserId()); - $enrollment = Enrollment::get(); + $enrollment = Enrollment::where('student_id', currentUserId())->get(); $course = Course::get(); $checkout = Checkout::get(); // $purchaseHistory = Enrollment::with(['course', 'checkout'])->orderBy('enrollment_date', 'desc')->get(); diff --git a/app/Http/Controllers/Students/ProfileController.php b/app/Http/Controllers/Students/ProfileController.php index edf964c..6a5ca9d 100644 --- a/app/Http/Controllers/Students/ProfileController.php +++ b/app/Http/Controllers/Students/ProfileController.php @@ -11,14 +11,14 @@ class ProfileController extends Controller { public function index() { - $student_info=Student::find(currentUserId()); - return view('students.profile',compact('student_info')); + $student_info = Student::find(currentUserId()); + return view('students.profile', compact('student_info')); } public function save_profile(Request $request) { try { - $data=Student::find(currentUserId()); + $data = Student::find(currentUserId()); $data->name_en = $request->fullName_en; $data->contact_en = $request->contactNumber_en; $data->email = $request->emailAddress; @@ -36,7 +36,7 @@ public function save_profile(Request $request) $request->image->move(public_path('uploads/students'), $imageName); $data->image = $imageName; } - if ($data->save()){ + if ($data->save()) { $this->setSession($data); return redirect()->back()->with('success', 'Data Saved'); } @@ -55,7 +55,7 @@ public function change_password(Request $request) if (!Hash::check($request->current_password, $data->password)) { return redirect()->back()->with('error', 'Current password is incorrect.'); } - + // Proceed with password change $data->password = Hash::make($request->password); $data->language = 'en'; @@ -77,7 +77,7 @@ public function setSession($student) 'userName' => encryptor('encrypt', $student->name_en), 'emailAddress' => encryptor('encrypt', $student->email), 'studentLogin' => 1, - 'image' => $student->image ?? 'No Image Found' + 'image' => $student->image ?? 'No Image Found' ] ); } @@ -103,5 +103,4 @@ public function changeImage(Request $request) return redirect()->back()->with('error', 'An error occurred. Please try again.'); } } - } diff --git a/resources/views/frontend/cart.blade.php b/resources/views/frontend/cart.blade.php index b3b80de..21dcefa 100644 --- a/resources/views/frontend/cart.blade.php +++ b/resources/views/frontend/cart.blade.php @@ -36,7 +36,7 @@
{{$details['quantity']}} +
{{$details['price'] ? '$' . $details['price'] : 'Free'}}
{{$details['old_price'] ? '$' . $details['old_price'] : ''}}
{{'$' . number_format((float) isset(session('cart_details')['discount_amount']) ? session('cart_details')['discount_amount']: 0.00 , 2)}}
+ {{ array_key_exists('discount_amount', session('cart_details')) ?number_format(session('cart_details')['discount_amount'], 2) : ' 0.00' }}{{'$' . number_format((float) session('cart_details')['tax'] , 2)}}