File tree Expand file tree Collapse file tree 6 files changed +56
-0
lines changed
app/Http/Controllers/Admin Expand file tree Collapse file tree 6 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Http \Controllers \Admin ;
4+
5+ use App \Thread ;
6+ use App \Trending ;
7+ use App \Http \Controllers \Controller ;
8+
9+ class ThreadController extends Controller
10+ {
11+ public function index (Trending $ trending )
12+ {
13+ return view ('admin.threads.index ' , ['trending ' => $ trending ->get ()]);
14+ }
15+
16+ public function reset (Thread $ thread , Trending $ trending )
17+ {
18+ $ trending ->reset ($ thread );
19+
20+ return back ()->with ('flash ' , trans ('messages.admin_reset_threads_trending_success ' ));
21+ }
22+ }
Original file line number Diff line number Diff line change 121121 'admin_new_channel ' => 'New channel ' ,
122122 'admin_add_channel ' => 'Add new channel ' ,
123123 'admin_add_channel_success ' => 'Channel created successfully! ' ,
124+ 'admin_reset_threads_trending ' => 'Reset all trending threads ' ,
125+ 'admin_reset_threads_trending_success ' => 'Reset all trending threads succeeded! ' ,
124126];
Original file line number Diff line number Diff line change 121121 'admin_new_channel ' => '新频道 ' ,
122122 'admin_add_channel ' => '添加新频道 ' ,
123123 'admin_add_channel_success ' => '频道创建成功! ' ,
124+ 'admin_reset_threads_trending ' => '重置热门话题 ' ,
125+ 'admin_reset_threads_trending_success ' => '重置热门话题成功! ' ,
124126];
Original file line number Diff line number Diff line change 1111 <li class =" nav-link" role =" presentation" >
1212 <a href =" {{ route (' admin.channel.index' ) } }" >@lang (' messages.nav_channels' )</a >
1313 </li >
14+ <li class =" nav-link" role =" presentation" >
15+ <a href =" {{ route (' admin.thread.index' ) } }" >@lang (' messages.threads_trending' )</a >
16+ </li >
1417 </ul >
1518 </div >
1619
Original file line number Diff line number Diff line change 1+ @extends (' admin.layouts.app' )
2+
3+ @section (' title' )
4+ @lang (' messages.admin_dashboard' ) / @lang (' messages.threads_trending' ) - {{ config (' app.name' ) } }
5+ @endsection
6+
7+ @section (' administration-content' )
8+ <p >
9+ <a class =" btn btn-sm btn-dark" href =" {{ route (' admin.thread.reset' ) } }" >
10+ @lang (' messages.admin_reset_threads_trending' ) <span class =" glyphicon glyphicon-plus" ></span >
11+ </a >
12+ </p >
13+
14+ <div class =" card" >
15+ @forelse ($trending as $thread )
16+ <li class =" list-group-item" >
17+ <a href =" {{ url ($thread -> path ) } }" style =" color : #333333 ;" >
18+ {{ $thread -> title } }
19+ </a >
20+ </li >
21+ @empty
22+ @lang (' messages.threads_no_trending' )
23+ @endforelse
24+ </div >
25+ @endsection
Original file line number Diff line number Diff line change 7272 Route::post ('/channel ' , 'ChannelController@store ' )->name ('admin.channel.store ' );
7373 Route::get ('/channel ' , 'ChannelController@index ' )->name ('admin.channel.index ' );
7474 Route::get ('/channel/create ' , 'ChannelController@create ' )->name ('admin.channel.create ' );
75+ Route::get ('/thread ' , 'ThreadController@index ' )->name ('admin.thread.index ' );
76+ Route::get ('/thread/reset ' , 'ThreadController@reset ' )->name ('admin.thread.reset ' );
7577});
You can’t perform that action at this time.
0 commit comments