Skip to content

Commit 62b81e6

Browse files
committed
My payment fixed frontend.
1 parent 46629cd commit 62b81e6

File tree

4 files changed

+56
-3
lines changed

4 files changed

+56
-3
lines changed

app/Http/Controllers/Frontend/Page/PageController.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,19 @@ public function myCourses()
113113
//show all my payments/payment history in frontend
114114
public function myPayments()
115115
{
116-
$payments = User::find(auth()->id())->purchases();
116+
$payments = User::find(auth()->id())->purchases()->get();
117+
// dd($payments);
117118
return view('frontend.pages.myPayments', compact('payments'));
118119
}
119120
//Contact Developers page:
120121
public function contactDevelopers()
121122
{
122123
return view('frontend.pages.contact-developers');
123124
}
125+
126+
//shwo payment history
127+
public function myPaymentShow($id){
128+
$history = Purchase::find($id)->where('user_id', auth()->id())->first();
129+
return view('frontend.pages.myPaymentShow', compact('history'));
130+
}
124131
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
@extends('frontend.layouts.app')
2+
@section('main')
3+
<div class="container my-5">
4+
<div class="col-md-2"></div>
5+
<div class="col-md-8">
6+
<h3 class="text-center text-muted">Show my payments:</h3>
7+
<div class="row">
8+
<div class="col-md-12 p-2">
9+
<h4>Product Name:
10+
{{ $history->name }}
11+
</h4>
12+
</div>
13+
<div class="col-md-4 mb-3 p-2">
14+
Contact Number:
15+
{{ $history->contact_number }}
16+
</div>
17+
<div class="col-md-4 mb-3 p-2">
18+
Payment Method:
19+
{{ $history->billing_type }}
20+
</div>
21+
<div class="col-md-4 mb-3 p-2">
22+
Payment Method:
23+
{{ $history->payment_number }}
24+
</div>
25+
<div class="col-md-4 mb-3 p-2">
26+
Payment Amount:
27+
{{ $history->payment_amount }}
28+
</div>
29+
<div class="col-md-4 mb-3 p-2">
30+
TRX ID:
31+
{{ $history->trx_id }}
32+
</div>
33+
<div class="col-md-4 mb-3 p-2">
34+
TRX ID:
35+
{{ $history->payment_date }}
36+
</div>
37+
<div class="col-md-12 p-2">
38+
Status:
39+
<span class="{{ $history->approved == 1 ? 'text-success' : 'text-danger' }}">{{ $history->approved == 1 ? 'Approved!' : 'Pendding!' }}</span>
40+
</div>
41+
</div>
42+
</div>
43+
<div class="col-md-2"></div>
44+
</div>
45+
@endsection

resources/views/frontend/pages/myPayments.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class="gap-2 d-flex align-items-start text-reset">
2727
</div>
2828
<div>
2929
<div class="fw-medium">{{ $course->name }}</div>
30-
<div>{{ $course->videos()->count() }} Videos</div>
30+
<div>{{ $course->purchasable_type }} </div>
3131
</div>
3232
</a>
3333
</td>
@@ -54,7 +54,7 @@ class="text-reset">{{ fake()->name('female') }}</a>
5454
<td>
5555
<div>
5656
<x-backend.ui.button type="custom" class="btn-sm text-capitalize btn-dark "
57-
href="#">
57+
href="{{ route('page.my.payment.show', $course->id) }}">
5858
Preview
5959
</x-backend.ui.button>
6060
</div>

routes/frontend.php

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
Route::get('/promo-codes', [PageController::class, 'PromoCodePage'])->name('page.promo.code');
100100
Route::get('/my-courses', [PageController::class, 'myCourses'])->name('page.my.courses');
101101
Route::get('/my-payments', [PageController::class, 'myPayments'])->name('page.my.payments');
102+
Route::get('/my-payments/show/{id}', [PageController::class, 'myPaymentShow'])->name('page.my.payment.show');
102103
// user generated refer link
103104
Route::get('/register/r/{user_name}', [RegisteredUserController::class, 'create'])->name('refer.link');
104105

0 commit comments

Comments
 (0)