index.blade.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. {{--<x-app-layout>--}}
  2. {{-- <x-slot name="header">--}}
  3. {{-- <h2 class="font-semibold text-xl text-gray-800 leading-tight">--}}
  4. {{-- 文章列表--}}
  5. {{-- </h2>--}}
  6. {{-- </x-slot>--}}
  7. <div class="py-12">
  8. <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
  9. <div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
  10. <div class="flex justify-center">
  11. <table class="w-full m-8">
  12. <thead>
  13. <tr>
  14. <th class="px-4 py-2">ID</th>
  15. <th class="px-4 py-2">Title</th>
  16. <th class="px-4 py-2">Author</th>
  17. <th class="px-4 py-2">Created At</th>
  18. </tr>
  19. </thead>
  20. <tbody>
  21. @foreach ($posts as $post)
  22. <tr>
  23. <td class="border px-4 py-2">{{ $post->id }}</td>
  24. <td class="border px-4 py-2">{{ $post->title }}</td>
  25. <td class="border px-4 py-2">{{ $post->author->name }}</td>
  26. <td class="border px-4 py-2">{{ $post->created_at->diffForHumans() }}</td>
  27. </tr>
  28. @endforeach
  29. </tbody>
  30. </table>
  31. </div>
  32. <div class="max-w-full m-8">
  33. {{ $posts->links() }}
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. {{--</x-app-layout>--}}