Skip to content

Commit c9ec831

Browse files
late submit and complete user panel (orginal is: dev.0.0.1)
1 parent 3af3614 commit c9ec831

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

app/Http/Controllers/HomeController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Http\Controllers;
44

5+
use App\Models\Transaction;
56
use Illuminate\Http\Request;
67

78
class HomeController extends Controller
@@ -23,6 +24,8 @@ public function __construct()
2324
*/
2425
public function index()
2526
{
26-
return view('home');
27+
$data['user'] = auth()->user();
28+
$data['transactions'] = Transaction::where('user_id', $data['user']->id)->get();
29+
return view('home',compact('data'));
2730
}
2831
}

resources/views/home.blade.php

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,53 @@
1414
</div>
1515
@endif
1616

17-
{{ __('You are logged in!') }}
17+
<div class="row">
18+
<div class="col-md-4">
19+
<div class="card">
20+
<div class="card-body bg-info text-center">
21+
<h2>Balance</h2>
22+
<h3>{{ $data['user']->balance }} BDT</h3>
23+
</div>
24+
</div>
25+
</div>
26+
<div class="col-md-8">
27+
<div class="card">
28+
<div class="card-header">
29+
<div class="card-title">All Transaction</div>
30+
</div>
31+
<div class="card-body">
32+
<div class="table-responsive">
33+
<table class="table table-bordered">
34+
<thead>
35+
<tr>
36+
<th>#</th>
37+
<th>Name</th>
38+
<th>Email</th>
39+
<th>Amount</th>
40+
<th>Fee</th>
41+
<th>Date</th>
42+
</tr>
43+
</thead>
44+
<tbody>
45+
@foreach ($data['transactions'] as $transaction)
46+
<tr>
47+
<th>{{ $loop->iteration }}</th>
48+
<th>{{ $transaction->user->name }}</th>
49+
<th>{{ $transaction->user->email }}</th>
50+
<th>{{ $transaction->amount }}</th>
51+
<th>{{ $transaction->fee }}</th>
52+
<th>{{ $transaction->date }}</th>
53+
</tr>
54+
@endforeach
55+
</tbody>
56+
</table>
57+
</div>
58+
</div>
59+
</div>
60+
</div>
61+
</div>
62+
63+
{{-- {{ __('You are logged in!') }} --}}
1864
</div>
1965
</div>
2066
</div>

0 commit comments

Comments
 (0)