File tree Expand file tree Collapse file tree 2 files changed +51
-2
lines changed Expand file tree Collapse file tree 2 files changed +51
-2
lines changed Original file line number Diff line number Diff line change 22
33namespace App \Http \Controllers ;
44
5+ use App \Models \Transaction ;
56use Illuminate \Http \Request ;
67
78class 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}
Original file line number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments