Add controllers for Anggota, Buku, Kategori, Peminjaman, and Dashboard with CRUD operations

This commit is contained in:
2026-03-17 21:43:05 +07:00
parent e8e28349fc
commit 2614a61743
5 changed files with 344 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers;
use App\Models\Anggota;
use App\Models\Buku;
use App\Models\Peminjaman;
use App\Models\Kategori;
use Inertia\Inertia;
class DashboardController extends Controller
{
public function index()
{
return Inertia::render('Dashboard', [
'stats' => [
'total_buku' => Buku::count(),
'total_anggota' => Anggota::where('status', 'aktif')->count(),
'total_peminjaman' => Peminjaman::where('status', 'dipinjam')->count(),
'total_terlambat' => Peminjaman::where('status', 'terlambat')->count(),
],
'peminjaman_terbaru' => Peminjaman::with(['anggota', 'buku'])
->latest()
->take(5)
->get(),
]);
}
}