1
0

HomeController.php 511 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\Article;
  4. class HomeController extends Controller
  5. {
  6. /**
  7. * Show the application dashboard.
  8. *
  9. * @return \Illuminate\Http\Response
  10. */
  11. public function index()
  12. {
  13. $articles = Article::query()
  14. ->with([
  15. 'category'
  16. ])
  17. ->orderBy('sort','desc')
  18. ->orderBy('id', 'desc')
  19. ->paginate();
  20. return view('default.home', compact('articles'));
  21. }
  22. }