Route加路徑Route::get('posts/hot', ['as'=>'posts.hot','uses'=>'PostController@hot']);
PostController加hot functionpublic function hot(){ $posts = Post::with('user') ->where('page_views', '>=' , 100) ->orderBy('page_views', 'desc') ->paginate(5) ; //dd($posts); return view('posts.index', compact('posts')); }
沒有留言:
張貼留言