ferdysetia_aan

TK3 - No.1 - index.blade.php

Jul 26th, 2025
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.20 KB | None | 0 0
  1. @extends('layouts.app')
  2.  
  3. @section('content')
  4.     <div class="container">
  5.         <h1 class="page-title">Daftar Berita</h1>
  6.         <a href="{{ route('berita.create') }}" class="btn btn-primary">Tambah Berita</a>
  7.         <table class="news-table">
  8.             <thead>
  9.                 <tr>
  10.                     <th>Judul</th>
  11.                     <th>Konten</th>
  12.                     <th>Aksi</th>
  13.                 </tr>
  14.             </thead>
  15.             <tbody>
  16.                 @foreach ($beritas as $berita)
  17.                     <tr>
  18.                         <td>{{ $berita->judul }}</td>
  19.                         <td>{{ \Str::limit($berita->konten, 50) }}</td> <!-- Limit content to 50 characters for a cleaner view -->
  20.                         <td class="actions">
  21.                             <a href="{{ route('berita.show', $berita->id_berita) }}" class="btn btn-info">Lihat</a>
  22.                             <a href="{{ route('berita.edit', $berita->id_berita) }}" class="btn btn-warning">Edit</a>
  23.                             <form action="{{ route('berita.destroy', $berita->id_berita) }}" method="POST" style="display:inline;">
  24.                                 @csrf
  25.                                 @method('DELETE')
  26.                                 <button type="submit" class="btn btn-danger">Hapus</button>
  27.                             </form>
  28.                         </td>
  29.                     </tr>
  30.                 @endforeach
  31.             </tbody>
  32.         </table>
  33.     </div>
  34. @endsection
  35.  
  36. @section('css')
  37.     <style>
  38.         .container {
  39.             width: 90%;
  40.             max-width: 1200px; /* Maximum width for larger screens */
  41.             margin: 0 auto;
  42.         }
  43.  
  44.         .page-title {
  45.             font-size: 2.5rem;
  46.             margin-bottom: 20px;
  47.             font-weight: bold;
  48.             color: #333;
  49.            text-align: center;
  50.         }
  51.  
  52.         .btn {
  53.             padding: 10px 20px;
  54.             text-align: center;
  55.             border-radius: 5px;
  56.             text-decoration: none;
  57.             display: inline-block;
  58.             font-size: 14px;
  59.             margin-right: 5px;
  60.             cursor: pointer;
  61.             transition: background-color 0.3s ease;
  62.         }
  63.  
  64.         .btn-primary {
  65.             background-color: #007bff;
  66.            color: white;
  67.             border: none;
  68.         }
  69.  
  70.         .btn-primary:hover {
  71.             background-color: #0056b3;
  72.        }
  73.  
  74.         .btn-info {
  75.             background-color: #17a2b8;
  76.            color: white;
  77.             border: none;
  78.         }
  79.  
  80.         .btn-info:hover {
  81.             background-color: #138496;
  82.        }
  83.  
  84.         .btn-warning {
  85.             background-color: #ffc107;
  86.            color: white;
  87.             border: none;
  88.         }
  89.  
  90.         .btn-warning:hover {
  91.             background-color: #e0a800;
  92.        }
  93.  
  94.         .btn-danger {
  95.             background-color: #dc3545;
  96.            color: white;
  97.             border: none;
  98.         }
  99.  
  100.         .btn-danger:hover {
  101.             background-color: #c82333;
  102.        }
  103.  
  104.         .news-table {
  105.             width: 100%;
  106.             border-collapse: collapse;
  107.             margin-top: 20px;
  108.             box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  109.         }
  110.  
  111.         .news-table th, .news-table td {
  112.             padding: 15px;
  113.             text-align: left;
  114.             border: 1px solid #ddd;
  115.        }
  116.  
  117.         .news-table th {
  118.             background-color: #f8f9fa;
  119.            font-weight: bold;
  120.             color: #333;
  121.        }
  122.  
  123.         .news-table tbody tr:hover {
  124.             background-color: #f1f1f1;
  125.        }
  126.  
  127.         .actions {
  128.             display: flex;
  129.             gap: 10px;
  130.             justify-content: center;
  131.         }
  132.  
  133.         .actions form {
  134.             margin: 0;
  135.         }
  136.  
  137.         /* Responsive Design */
  138.         @media (max-width: 768px) {
  139.             .container {
  140.                 width: 100%;
  141.             }
  142.  
  143.             .page-title {
  144.                 font-size: 2rem;
  145.             }
  146.  
  147.             .btn {
  148.                 width: 100%;
  149.                 margin-bottom: 10px;
  150.             }
  151.  
  152.             .news-table th, .news-table td {
  153.                 padding: 10px;
  154.             }
  155.         }
  156.     </style>
  157. @endsection
Advertisement
Add Comment
Please, Sign In to add comment