File tree Expand file tree Collapse file tree 2 files changed +34
-3
lines changed
Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 22
33namespace App \Http \Controllers ;
44
5+ use App \Blog ;
56use App \Mail \RegMail ;
67use Illuminate \Http \Request ;
78
@@ -12,8 +13,7 @@ class WelcomeController extends Controller
1213 */
1314 public function home ()
1415 {
15- // $user = \App\User::find(1);
16- // \Mail::to($user)->send(new RegMail());
17- return view ('home ' );
16+ $ blogs = Blog::orderBy ('id ' , 'DESC ' )->with ('user ' )->paginate (10 );
17+ return view ('home ' , compact ('blogs ' ));
1818 }
1919}
Original file line number Diff line number Diff line change 2727 </div >
2828 </div >
2929 </form >
30+
31+ <div class =" card mt-2" >
32+ <div class =" card-header" >
33+ 博客列表
34+ </div >
35+ <div class =" card-body" >
36+ <table class =" table" >
37+ <thead >
38+ <tr >
39+ <th >ID</th >
40+ <th >博客</th >
41+ <th >用户</th >
42+ <th width =" 150px" >操作</th >
43+ </tr >
44+ </thead >
45+ <tbody >
46+ @foreach ($blogs as $blog )
47+ <tr >
48+ <td scope =" row" >{{ $blog [' id' ]} } </td >
49+ <td >{{ $blog [' content' ]} } </td >
50+ <td >{{ $blog -> user -> name } } </td >
51+ <td ></td >
52+ </tr >
53+ @endforeach
54+ </tbody >
55+ </table >
56+ </div >
57+ <div class =" card-footer text-muted" >
58+ {{ $blogs -> links () } }
59+ </div >
60+ </div >
3061@stop
You can’t perform that action at this time.
0 commit comments