Edit File: history-index.blade.php
<?php use Carbon\Carbon; use App\Models\History; use Livewire\Volt\Component; use Livewire\WithPagination; use Livewire\Attributes\Layout; new #[Layout("layouts.admin")] class extends Component { use WithPagination; public function with(): array { return [ 'histories' => History::orderByDesc("created_at")->paginate(100), ]; } }; ?> <div> <x-slot name="header"> <di class="relative"> <h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight text-center"> {{ __('History Admin') }} </h2> </di> </x-slot> <div class="py-12"> <div class=" mx-auto sm:px-6 lg:px-8"> <div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg text-sm lg:text-base"> @if (count($histories) == 0) <h1 class="text-center text-3xl p-8">TIDAK ADA HISTORY</h1> @else <x-display-table :columns="['username', 'title', 'page', 'date']" routeName="admin.history"> @foreach ($histories as $history) <tbody> <tr class="{{ $history->status == "success" ? "bg-green-600/50" : ($history->status == "info" ? "bg-sky-600/50" : "bg-red-600/50")}} dark:text-white hover:bg-red-600/25"> <td class="text-center py-2 border border-black dark:border-white w-1/12">{{$history->name}}</td> <td class="text-center py-2 border border-black dark:border-white w-8/12 px-8">{{$history->title}}</td> <td class="text-center py-2 border border-black dark:border-white w-1/12">{{$history->page}}</td> <td class="text-center py-2 border border-black dark:border-white w-2/12">{{Carbon::parse($history->created_at)->isoFormat("D MMMM YYYY")}}</td> </tr> </tbody> @endforeach </x-display-table> @endif </div> </div> </div> <div class="w-full max-w-7xl p-2 border-2 border-black dark:border-white mx-auto"> {{ $histories->links() }} </div> </div>
Back