first commit
This commit is contained in:
commit
01c985e0f6
|
|
@ -0,0 +1,18 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[compose.yaml]
|
||||
indent_size = 4
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
APP_LOCALE=en
|
||||
APP_FALLBACK_LOCALE=en
|
||||
APP_FAKER_LOCALE=en_US
|
||||
|
||||
APP_MAINTENANCE_DRIVER=file
|
||||
# APP_MAINTENANCE_STORE=database
|
||||
|
||||
PHP_CLI_SERVER_WORKERS=4
|
||||
|
||||
BCRYPT_ROUNDS=12
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_STACK=single
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=sqlite
|
||||
# DB_HOST=127.0.0.1
|
||||
# DB_PORT=3306
|
||||
# DB_DATABASE=laravel
|
||||
# DB_USERNAME=root
|
||||
# DB_PASSWORD=
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_ENCRYPT=false
|
||||
SESSION_PATH=/
|
||||
SESSION_DOMAIN=null
|
||||
|
||||
BROADCAST_CONNECTION=log
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=database
|
||||
|
||||
CACHE_STORE=database
|
||||
# CACHE_PREFIX=
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_CLIENT=phpredis
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=log
|
||||
MAIL_SCHEME=null
|
||||
MAIL_HOST=127.0.0.1
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
* text=auto eol=lf
|
||||
|
||||
*.blade.php diff=html
|
||||
*.css diff=css
|
||||
*.html diff=html
|
||||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
*.log
|
||||
.DS_Store
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpactor.json
|
||||
.phpunit.result.cache
|
||||
/.fleet
|
||||
/.idea
|
||||
/.nova
|
||||
/.phpunit.cache
|
||||
/.vscode
|
||||
/.zed
|
||||
/auth.json
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/storage/pail
|
||||
/vendor
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
Thumbs.db
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel)**
|
||||
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
|
||||
- **[Redberry](https://redberry.international/laravel-development)**
|
||||
- **[Active Logic](https://activelogic.com)**
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Buku;
|
||||
use App\Models\Anggota;
|
||||
use App\Models\Peminjaman;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$bukuPopuler = Buku::withCount('peminjaman')
|
||||
->orderBy('peminjaman_count', 'desc')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
$totalBuku = Buku::count();
|
||||
$totalAnggota = Anggota::count();
|
||||
$totalPeminjamanHariIni = Peminjaman::whereDate('tanggal_pinjam', now()->toDateString())->count();
|
||||
|
||||
return view('admin.index', compact('totalBuku', 'totalAnggota', 'totalPeminjamanHariIni', 'bukuPopuler'));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Validation\Rules;
|
||||
|
||||
class AdminAkunController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$admins = User::where('role', 'admin')->get();
|
||||
return view('admin.akun.index', compact('admins'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||
]);
|
||||
|
||||
User::create([
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'password' => Hash::make($request->password),
|
||||
'role' => 'admin',
|
||||
]);
|
||||
|
||||
return redirect()->route('admin.akun.index')->with('success', 'Akun admin baru berhasil ditambahkan!');
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$admin = User::where('role', 'admin')->findOrFail($id);
|
||||
|
||||
// Prevent deleting the last admin
|
||||
$adminCount = User::where('role', 'admin')->count();
|
||||
if ($adminCount <= 1) {
|
||||
return redirect()->route('admin.akun.index')->with('error', 'Tidak dapat menghapus admin terakhir!');
|
||||
}
|
||||
|
||||
// Prevent deleting currently logged in admin if you want, but simple implementation:
|
||||
if (auth()->id() == $admin->id) {
|
||||
return redirect()->route('admin.akun.index')->with('error', 'Tidak dapat menghapus akun Anda sendiri saat sedang login!');
|
||||
}
|
||||
|
||||
$admin->delete();
|
||||
|
||||
return redirect()->route('admin.akun.index')->with('success', 'Akun admin berhasil dihapus!');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Buku;
|
||||
use App\Models\Kategori;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AdminBukuController extends Controller
|
||||
{
|
||||
public function create()
|
||||
{
|
||||
$kategori = Kategori::all();
|
||||
return view('admin.buku.create', compact('kategori'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'bibid' => 'required|string|max:30|unique:buku,bibid',
|
||||
'judul' => 'required|string',
|
||||
'pengarang' => 'required|string|max:100',
|
||||
'penerbit' => 'nullable|string',
|
||||
'tahun_terbit' => 'nullable|digits:4',
|
||||
'edisi' => 'nullable|string|max:50',
|
||||
'deskripsi_fisik' => 'nullable|string|max:100',
|
||||
'nomor_panggil' => 'required|string|max:50',
|
||||
'eksemplar' => 'required|integer|min:1',
|
||||
'id_kategori' => 'required|exists:kategori,id_kategori',
|
||||
'cover' => 'nullable|image|mimes:jpeg,png,jpg|max:2048'
|
||||
]);
|
||||
|
||||
if ($request->hasFile('cover')) {
|
||||
$validated['cover'] = $request->file('cover')->store('covers', 'public');
|
||||
}
|
||||
|
||||
$validated['konten_digital'] = 0;
|
||||
Buku::create($validated);
|
||||
|
||||
return back()->with('success', 'Aset buku baru berhasil ditambahkan.');
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$search = $request->input('search');
|
||||
$buku = Buku::with('kategori')
|
||||
->when($search, function($query, $search) {
|
||||
return $query->where('judul', 'like', "%{$search}%")
|
||||
->orWhere('bibid', 'like', "%{$search}%");
|
||||
})
|
||||
->paginate(15);
|
||||
|
||||
$kategori = Kategori::all();
|
||||
|
||||
return view('admin.buku.index', compact('buku', 'search', 'kategori'));
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$buku = Buku::findOrFail($id);
|
||||
$kategori = Kategori::all();
|
||||
|
||||
return view('admin.buku.edit', compact('buku', 'kategori'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$buku = Buku::findOrFail($id);
|
||||
|
||||
$validated = $request->validate([
|
||||
'bibid' => 'required|string|max:30|unique:buku,bibid,' . $id . ',id_buku',
|
||||
'judul' => 'required|string',
|
||||
'pengarang' => 'required|string|max:100',
|
||||
'penerbit' => 'nullable|string',
|
||||
'tahun_terbit' => 'nullable|digits:4',
|
||||
'edisi' => 'nullable|string|max:50',
|
||||
'deskripsi_fisik' => 'nullable|string|max:100',
|
||||
'nomor_panggil' => 'required|string|max:50',
|
||||
'eksemplar' => 'required|integer|min:1',
|
||||
'id_kategori' => 'required|exists:kategori,id_kategori',
|
||||
'cover' => 'nullable|image|mimes:jpeg,png,jpg|max:2048'
|
||||
]);
|
||||
|
||||
if ($request->hasFile('cover')) {
|
||||
if ($buku->cover && \Illuminate\Support\Facades\Storage::disk('public')->exists($buku->cover)) {
|
||||
\Illuminate\Support\Facades\Storage::disk('public')->delete($buku->cover);
|
||||
}
|
||||
$validated['cover'] = $request->file('cover')->store('covers', 'public');
|
||||
}
|
||||
|
||||
$buku->update($validated);
|
||||
|
||||
return redirect()->route('admin.buku.index')->with('success', 'Aset buku berhasil diperbarui.');
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$buku = Buku::findOrFail($id);
|
||||
$buku->delete();
|
||||
|
||||
return redirect()->route('admin.buku.index')->with('success', 'Aset buku berhasil dihapus dari sistem.');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,299 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Peminjaman;
|
||||
use App\Models\Buku;
|
||||
use App\Models\Anggota;
|
||||
use Illuminate\Http\Request;
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class AdminPeminjamanController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$search = $request->input('search');
|
||||
|
||||
$query = Peminjaman::with(['buku', 'anggota', 'user'])->latest();
|
||||
|
||||
if ($search) {
|
||||
$searchTerm = strtolower($search);
|
||||
$query->where(function ($q) use ($searchTerm) {
|
||||
$q->whereHas('anggota', function ($qMember) use ($searchTerm) {
|
||||
$qMember->whereRaw('LOWER(nama) LIKE ?', ["%{$searchTerm}%"]);
|
||||
})->orWhereHas('buku', function ($qBuku) use ($searchTerm) {
|
||||
$qBuku->whereRaw('LOWER(judul) LIKE ?', ["%{$searchTerm}%"]);
|
||||
})->orWhereHas('user', function ($qUser) use ($searchTerm) {
|
||||
$qUser->whereRaw('LOWER(name) LIKE ?', ["%{$searchTerm}%"]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$peminjaman = $query->paginate(15)->appends(['search' => $search]);
|
||||
|
||||
$buku = Buku::orderBy('judul', 'asc')->get();
|
||||
$anggota = Anggota::orderBy('nama', 'asc')->get();
|
||||
return view('admin.peminjaman.index', compact('peminjaman', 'buku', 'anggota', 'search'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$buku = Buku::where('eksemplar', '>', 0)->orderBy('judul', 'asc')->get();
|
||||
$anggota = Anggota::orderBy('nama', 'asc')->get();
|
||||
return view('admin.peminjaman.create', compact('buku', 'anggota'));
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$peminjaman = Peminjaman::findOrFail($id);
|
||||
$buku = Buku::all();
|
||||
$anggota = Anggota::orderBy('nama', 'asc')->get();
|
||||
return view('admin.peminjaman.edit', compact('peminjaman', 'buku', 'anggota'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
// 1. Validasi Input
|
||||
$validated = $request->validate([
|
||||
'id_anggota' => 'required|exists:anggotas,id',
|
||||
'id_buku' => 'required|exists:buku,id_buku',
|
||||
'tanggal_pinjam' => 'required|date',
|
||||
'tanggal_kembali' => 'required|date|after_or_equal:tanggal_pinjam',
|
||||
]);
|
||||
|
||||
$validated['status_peminjaman'] = 'Dipinjam';
|
||||
|
||||
// 2. Kurangi Stok Buku
|
||||
$buku = Buku::findOrFail($validated['id_buku']);
|
||||
$buku->decrement('eksemplar');
|
||||
|
||||
// 3. Simpan ke Database
|
||||
$peminjaman = Peminjaman::create($validated);
|
||||
$peminjaman->load(['buku', 'anggota']);
|
||||
|
||||
$waSuccess = false;
|
||||
|
||||
// 4. Proses Kirim WA (Format Struk Teks Resmi)
|
||||
try {
|
||||
$targetNum = $peminjaman->anggota->no_hp ?? '';
|
||||
$fonnteToken = 'vpzqxF2ZGgTGz9F5UbUS'; // Token Fonnte
|
||||
|
||||
// Standarisasi Format Nomor ke awalan 62
|
||||
if (!empty($targetNum)) {
|
||||
$targetNum = preg_replace('/^0/', '62', trim($targetNum));
|
||||
}
|
||||
|
||||
if (!empty($targetNum) && !empty($fonnteToken)) {
|
||||
// Merangkai Teks Menyerupai Struk Kertas
|
||||
$pesanStruk = "🏢 *PERPUSTAKAAN DAERAH JEMBER*\n";
|
||||
$pesanStruk .= "Jl. Mastrip No. 1, Kabupaten Jember\n";
|
||||
$pesanStruk .= "===============================\n\n";
|
||||
$pesanStruk .= "📄 *BUKTI PEMINJAMAN BUKU*\n";
|
||||
$pesanStruk .= "No. Transaksi : PMJ-{$peminjaman->id_peminjaman}\n";
|
||||
$pesanStruk .= "Tanggal Cetak : " . \Carbon\Carbon::now()->format('d-m-Y H:i') . "\n\n";
|
||||
$pesanStruk .= "*DATA PEMINJAM*\n";
|
||||
$pesanStruk .= "Nama : {$peminjaman->anggota->nama}\n";
|
||||
$pesanStruk .= "No. HP : {$peminjaman->anggota->no_hp}\n\n";
|
||||
$pesanStruk .= "*DETAIL BUKU*\n";
|
||||
$pesanStruk .= "Judul : {$peminjaman->buku->judul}\n";
|
||||
$pesanStruk .= "Kode Pengembalian : {$peminjaman->buku->bibid}\n";
|
||||
$pesanStruk .= "Pinjam : " . \Carbon\Carbon::parse($peminjaman->tanggal_pinjam)->format('d F Y') . "\n";
|
||||
$pesanStruk .= "Kembali: *" . \Carbon\Carbon::parse($peminjaman->tanggal_kembali)->format('d F Y') . "*\n\n";
|
||||
$pesanStruk .= "===============================\n";
|
||||
$pesanStruk .= "⚠️ *Catatan:*\n";
|
||||
$pesanStruk .= "Tunjukkan Kode Pengembalian ke Admin saat pengembalian buku.\n";
|
||||
$pesanStruk .= "Harap kembalikan buku tepat waktu.\n";
|
||||
$pesanStruk .= "Denda keterlambatan: Rp 1.000/hari.\n\n";
|
||||
$pesanStruk .= "Terima kasih atas kunjungan Anda!\n";
|
||||
$pesanStruk .= "_Sistem Sarakata - TA 2026_";
|
||||
|
||||
// Eksekusi Pengiriman via Http Laravel
|
||||
$response = \Illuminate\Support\Facades\Http::withoutVerifying()->timeout(15)->withHeaders([
|
||||
'Authorization' => $fonnteToken,
|
||||
])->post('https://api.fonnte.com/send', [
|
||||
'target' => $targetNum,
|
||||
'message' => $pesanStruk,
|
||||
]);
|
||||
|
||||
if ($response->successful() && ($response->json('status') == true)) {
|
||||
$waSuccess = true;
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
\Illuminate\Support\Facades\Log::error("Error WA Pengiriman: " . $e->getMessage());
|
||||
}
|
||||
|
||||
// 5. Notifikasi Kembali ke Layar Admin
|
||||
$msg = 'Transaksi peminjaman berhasil dicatat.';
|
||||
if ($waSuccess) {
|
||||
$msg .= ' Struk WA berhasil terkirim kepada Anggota.';
|
||||
}
|
||||
|
||||
return redirect()->route('admin.peminjaman.index')->with('success', $msg);
|
||||
}
|
||||
|
||||
public function cetakStruk($id)
|
||||
{
|
||||
$peminjaman = Peminjaman::with(['buku', 'anggota', 'user'])->findOrFail($id);
|
||||
return view('admin.peminjaman.struk', compact('peminjaman'));
|
||||
}
|
||||
|
||||
public function scan()
|
||||
{
|
||||
return view('admin.peminjaman.scan');
|
||||
}
|
||||
|
||||
public function prosesScan(Request $request)
|
||||
{
|
||||
$request->validate(['bibid' => 'required|string']);
|
||||
|
||||
$buku = Buku::where('bibid', $request->bibid)->first();
|
||||
|
||||
if (!$buku) {
|
||||
return back()->with('error', 'Aset buku tidak ditemukan di dalam database.');
|
||||
}
|
||||
|
||||
$peminjaman = Peminjaman::with(['user', 'anggota'])
|
||||
->where('id_buku', $buku->id_buku)
|
||||
->where('status_peminjaman', 'Dipinjam')
|
||||
->first();
|
||||
|
||||
if (!$peminjaman) {
|
||||
return back()->with('error', 'Buku ini tidak dalam status dipinjam oleh siapapun.');
|
||||
}
|
||||
|
||||
$tanggal_kembali_seharusnya = \Carbon\Carbon::parse($peminjaman->tanggal_kembali);
|
||||
$tanggal_dikembalikan_aktual = \Carbon\Carbon::now();
|
||||
$denda = 0;
|
||||
if ($tanggal_dikembalikan_aktual->gt($tanggal_kembali_seharusnya)) {
|
||||
$selisih_hari = $tanggal_dikembalikan_aktual->diffInDays($tanggal_kembali_seharusnya);
|
||||
$denda = $selisih_hari * 1000;
|
||||
}
|
||||
|
||||
$lokasi = $this->prediksiLokasiRakUntukAdmin($buku->nomor_panggil);
|
||||
|
||||
return view('admin.peminjaman.scan', compact('buku', 'peminjaman', 'denda', 'lokasi'));
|
||||
}
|
||||
|
||||
private function prediksiLokasiRakUntukAdmin($nomor_panggil)
|
||||
{
|
||||
if (empty($nomor_panggil))
|
||||
return ['rak' => 'Tidak Diketahui', 'area' => '-'];
|
||||
$kode_utama = (int) substr(trim($nomor_panggil), 0, 3);
|
||||
|
||||
return match (true) {
|
||||
$kode_utama >= 0 && $kode_utama <= 99 => match (true) {
|
||||
$kode_utama <= 19 => ['rak' => 'Rak 01', 'area' => 'Karya Umum'],
|
||||
$kode_utama <= 50 => ['rak' => 'Rak 02', 'area' => 'Karya Umum'],
|
||||
default => ['rak' => 'Rak 03-05', 'area' => 'Karya Umum Lainnya'],
|
||||
},
|
||||
$kode_utama >= 100 && $kode_utama <= 199 => match (true) {
|
||||
$kode_utama <= 150 => ['rak' => 'Rak 06-10', 'area' => 'Filsafat'],
|
||||
default => ['rak' => 'Rak 11-14', 'area' => 'Psikologi'],
|
||||
},
|
||||
$kode_utama >= 200 && $kode_utama <= 299 => match (true) {
|
||||
$kode_utama == 297 => ['rak' => 'Rak 25-32', 'area' => 'Agama Islam'],
|
||||
default => ['rak' => 'Rak 15-24', 'area' => 'Agama Umum'],
|
||||
},
|
||||
$kode_utama >= 300 && $kode_utama <= 399 => match (true) {
|
||||
$kode_utama <= 330 => ['rak' => 'Rak 33-36', 'area' => 'Sosiologi & Politik'],
|
||||
$kode_utama <= 360 => ['rak' => 'Rak 37-40', 'area' => 'Ekonomi & Hukum'],
|
||||
default => ['rak' => 'Rak 41-44', 'area' => 'Pendidikan & Adat'],
|
||||
},
|
||||
$kode_utama >= 400 && $kode_utama <= 499 => ['rak' => 'Rak 45', 'area' => 'Bahasa'],
|
||||
$kode_utama >= 500 && $kode_utama <= 599 => ['rak' => 'Rak 46-48', 'area' => 'Ilmu Murni'],
|
||||
$kode_utama >= 600 && $kode_utama <= 699 => match (true) {
|
||||
$kode_utama <= 610 => ['rak' => 'Rak 49-53', 'area' => 'Kedokteran'],
|
||||
$kode_utama <= 630 => ['rak' => 'Rak 54-58', 'area' => 'Teknik'],
|
||||
$kode_utama <= 650 => ['rak' => 'Rak 59-63', 'area' => 'Pertanian'],
|
||||
default => ['rak' => 'Rak 64-68', 'area' => 'Manajemen Bisnis'],
|
||||
},
|
||||
$kode_utama >= 700 && $kode_utama <= 799 => match (true) {
|
||||
$kode_utama <= 739 => ['rak' => 'Rak 71', 'area' => 'Kesenian'],
|
||||
$kode_utama <= 769 => ['rak' => 'Rak 72', 'area' => 'Seni Rupa'],
|
||||
$kode_utama <= 789 => ['rak' => 'Rak 73', 'area' => 'Fotografi/Musik'],
|
||||
default => ['rak' => 'Rak 74', 'area' => 'Olahraga'],
|
||||
},
|
||||
$kode_utama >= 800 && $kode_utama <= 899 => ['rak' => 'Rak 77-79', 'area' => 'Sastra'],
|
||||
$kode_utama >= 900 && $kode_utama <= 999 => match (true) {
|
||||
$kode_utama <= 919 => ['rak' => 'Rak 69, 70', 'area' => 'Geografi'],
|
||||
default => ['rak' => 'Rak 80-84', 'area' => 'Sejarah Umum'],
|
||||
},
|
||||
default => ['rak' => 'Rak 75-76', 'area' => 'Koleksi Terbaru'],
|
||||
};
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'id_anggota' => 'required|exists:anggotas,id',
|
||||
'id_buku' => 'required|exists:buku,id_buku',
|
||||
'tanggal_pinjam' => 'required|date',
|
||||
'tanggal_kembali' => 'required|date|after_or_equal:tanggal_pinjam',
|
||||
]);
|
||||
|
||||
$peminjaman = Peminjaman::findOrFail($id);
|
||||
|
||||
// If the book changed, adjust stock
|
||||
if ($peminjaman->id_buku != $validated['id_buku']) {
|
||||
if ($peminjaman->status_peminjaman == 'Dipinjam') {
|
||||
$oldBuku = Buku::find($peminjaman->id_buku);
|
||||
if ($oldBuku) $oldBuku->increment('eksemplar');
|
||||
|
||||
$newBuku = Buku::findOrFail($validated['id_buku']);
|
||||
$newBuku->decrement('eksemplar');
|
||||
}
|
||||
}
|
||||
|
||||
$peminjaman->update($validated);
|
||||
|
||||
return redirect()->route('admin.peminjaman.index')->with('success', 'Data peminjaman berhasil diperbarui.');
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$peminjaman = Peminjaman::findOrFail($id);
|
||||
|
||||
if ($peminjaman->status_peminjaman == 'Dipinjam' && $peminjaman->buku) {
|
||||
$peminjaman->buku->increment('eksemplar');
|
||||
}
|
||||
|
||||
$peminjaman->delete();
|
||||
|
||||
return redirect()->route('admin.peminjaman.index')->with('success', 'Data peminjaman berhasil dihapus.');
|
||||
}
|
||||
|
||||
public function kembalikan($id)
|
||||
{
|
||||
$peminjaman = Peminjaman::findOrFail($id);
|
||||
|
||||
$tglTenggat = \Carbon\Carbon::parse($peminjaman->tanggal_kembali)->startOfDay();
|
||||
$tglSekarang = \Carbon\Carbon::now()->startOfDay();
|
||||
|
||||
$denda = 0;
|
||||
if ($tglSekarang->gt($tglTenggat)) {
|
||||
$selisihHari = $tglSekarang->diffInDays($tglTenggat);
|
||||
$denda = $selisihHari * 1000;
|
||||
}
|
||||
|
||||
$peminjaman->update([
|
||||
'status_peminjaman' => 'Dikembalikan',
|
||||
'tanggal_dikembalikan' => now(),
|
||||
'denda' => $denda
|
||||
]);
|
||||
|
||||
if ($peminjaman->buku) {
|
||||
$peminjaman->buku->increment('eksemplar');
|
||||
}
|
||||
|
||||
$pesan = 'Buku berhasil dikembalikan.';
|
||||
if ($denda > 0) {
|
||||
$pesan .= ' Denda keterlambatan Rp ' . number_format($denda, 0, ',', '.');
|
||||
}
|
||||
|
||||
return redirect()->back()->with('success', $pesan);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Anggota;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AnggotaController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$keyword = $request->search;
|
||||
|
||||
$anggota = Anggota::when($keyword, function ($q) use ($keyword) {
|
||||
$q->where('nama', 'like', "%$keyword%")
|
||||
->orWhere('no_identitas', 'like', "%$keyword%")
|
||||
->orWhere('no_ktp', 'like', "%$keyword%");
|
||||
})
|
||||
->latest()
|
||||
->paginate(10);
|
||||
|
||||
return view('anggota.index', compact('anggota'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('anggota.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'nama' => 'required|string|max:255',
|
||||
'jenis_anggota' => 'required|in:Mahasiswa,Siswa,Dosen,Umum',
|
||||
'no_identitas' => 'required|unique:anggotas,no_identitas',
|
||||
'no_ktp' => 'required|numeric|digits_between:10,16',
|
||||
'prodi' => 'nullable|string|max:255',
|
||||
'no_hp' => 'required|string|max:20',
|
||||
'alamat' => 'required|string',
|
||||
'nama_wali' => 'required|string|max:255',
|
||||
'no_hp_wali' => 'required|string|max:20',
|
||||
'hubungan_wali' => 'required|in:Orang Tua,Saudara,Dosen Wali,Lainnya',
|
||||
]);
|
||||
|
||||
Anggota::create($validated);
|
||||
|
||||
return redirect()
|
||||
->route('admin.anggota.member.index')
|
||||
->with('success', 'Data anggota berhasil ditambahkan!');
|
||||
}
|
||||
|
||||
public function edit(Anggota $member)
|
||||
{
|
||||
return view('anggota.edit', ['anggota' => $member]);
|
||||
}
|
||||
|
||||
public function update(Request $request, Anggota $member)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'nama' => 'required|string|max:255',
|
||||
'jenis_anggota' => 'required|in:Mahasiswa,Siswa,Dosen,Umum',
|
||||
'no_identitas' => 'required|unique:anggotas,no_identitas,' . $member->id,
|
||||
'no_ktp' => 'required|numeric|digits_between:10,16',
|
||||
'prodi' => 'nullable|string|max:255',
|
||||
'no_hp' => 'required|string|max:20',
|
||||
'alamat' => 'required|string',
|
||||
'nama_wali' => 'required|string|max:255',
|
||||
'no_hp_wali' => 'required|string|max:20',
|
||||
'hubungan_wali' => 'required|in:Orang Tua,Saudara,Dosen Wali,Lainnya',
|
||||
]);
|
||||
|
||||
$member->update($validated);
|
||||
|
||||
return redirect()
|
||||
->route('admin.anggota.member.index')
|
||||
->with('success', 'Data anggota berhasil diperbarui!');
|
||||
}
|
||||
|
||||
public function destroy(Anggota $member)
|
||||
{
|
||||
$member->delete();
|
||||
|
||||
return redirect()
|
||||
->route('admin.anggota.member.index')
|
||||
->with('success', 'Data anggota berhasil dihapus!');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/**
|
||||
* Halaman pilih login (landing page login)
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('auth.choose-login-admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Menampilkan form login Admin
|
||||
*/
|
||||
public function showAdminLoginForm()
|
||||
{
|
||||
return view('auth.login'); // login admin
|
||||
}
|
||||
|
||||
/**
|
||||
* Proses login Admin
|
||||
*/
|
||||
public function adminLogin(Request $request)
|
||||
{
|
||||
$credentials = $request->validate([
|
||||
'email' => 'required|email',
|
||||
'password' => 'required',
|
||||
]);
|
||||
|
||||
if (Auth::attempt($credentials, $request->remember)) {
|
||||
$request->session()->regenerate();
|
||||
|
||||
if (auth()->user()->role === 'admin') {
|
||||
return redirect()->route('admin.dashboard');
|
||||
}
|
||||
|
||||
Auth::logout();
|
||||
return back()->withErrors(['email' => 'Akun ini bukan admin']); // Pesan yang Anda dapatkan
|
||||
}
|
||||
|
||||
return back()->withErrors(['email' => 'Email atau password salah']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Menampilkan form login Pengunjung
|
||||
*/
|
||||
public function showUserLoginForm()
|
||||
{
|
||||
return view('auth.login-user'); // login pengunjung
|
||||
}
|
||||
|
||||
/**
|
||||
* Proses login Pengunjung
|
||||
*/
|
||||
public function userLogin(Request $request)
|
||||
{
|
||||
$credentials = $request->validate([
|
||||
'email' => 'required|email',
|
||||
'password' => 'required',
|
||||
]);
|
||||
|
||||
if (Auth::attempt($credentials, $request->remember)) {
|
||||
$request->session()->regenerate();
|
||||
|
||||
return redirect()->route('user.dashboard'); // dashboard pengunjung
|
||||
}
|
||||
|
||||
return back()->withErrors([
|
||||
'email' => 'Email atau password yang Anda masukkan salah.',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout untuk semua user
|
||||
*/
|
||||
public function logout(Request $request)
|
||||
{
|
||||
Auth::logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
return redirect()->route('home');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
// Menampilkan form pendaftaran
|
||||
public function showRegistrationForm()
|
||||
{
|
||||
return view('auth.register'); // Pastikan view register ada
|
||||
}
|
||||
|
||||
// Proses registrasi pengguna baru
|
||||
public function register(Request $request)
|
||||
{
|
||||
// Validasi input pendaftaran
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required|string|max:255',
|
||||
'email' => 'required|string|email|max:255|unique:users',
|
||||
'password' => 'required|string|min:8|confirmed',
|
||||
'no_hp' => 'required|string|max:15',
|
||||
'instansi' => 'required|string|max:255',
|
||||
'status' => 'required|string|max:50',
|
||||
'no_ktp' => 'required|string|max:20',
|
||||
'alasan' => 'required|string|max:255',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('register')
|
||||
->withErrors($validator)
|
||||
->withInput();
|
||||
}
|
||||
|
||||
// Simpan data pengguna baru
|
||||
$user = User::create([
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'password' => Hash::make($request->password),
|
||||
'role' => 'user',
|
||||
'no_hp' => $request->no_hp,
|
||||
'instansi' => $request->instansi,
|
||||
'status' => $request->status,
|
||||
'no_ktp' => $request->no_ktp,
|
||||
'alasan' => $request->alasan,
|
||||
]);
|
||||
|
||||
// Login otomatis setelah pendaftaran
|
||||
auth()->login($user);
|
||||
|
||||
// Redirect ke dashboard pengguna
|
||||
return redirect()->route('user.dashboard');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Buku;
|
||||
use Illuminate\Http\Request;
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
|
||||
class BukuController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$bukus = Buku::orderBy('judul')->paginate(10);
|
||||
|
||||
return view('buku.index', compact('bukus'));
|
||||
}
|
||||
|
||||
public function show(Buku $buku)
|
||||
{
|
||||
return view('buku.show', compact('buku'));
|
||||
}
|
||||
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('buku.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'judul' => 'required|string|max:255',
|
||||
'pengarang' => 'required|string|max:255',
|
||||
'penerbit' => 'required|string|max:255',
|
||||
'tahun_terbit' => 'required|digits:4',
|
||||
'stok' => 'required|integer|min:0',
|
||||
]);
|
||||
|
||||
Buku::create($validated);
|
||||
|
||||
return redirect()
|
||||
->route('admin.buku.index')
|
||||
->with('success', 'Data buku berhasil ditambahkan');
|
||||
}
|
||||
|
||||
public function edit(Buku $buku)
|
||||
{
|
||||
return view('buku.edit', compact('buku'));
|
||||
}
|
||||
|
||||
public function update(Request $request, Buku $buku)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'judul' => 'required|string|max:255',
|
||||
'pengarang' => 'required|string|max:255',
|
||||
'penerbit' => 'required|string|max:255',
|
||||
'tahun_terbit' => 'required|digits:4',
|
||||
'stok' => 'required|integer|min:0',
|
||||
]);
|
||||
|
||||
$buku->update($validated);
|
||||
|
||||
return redirect()
|
||||
->route('admin.buku.index')
|
||||
->with('success', 'Data buku berhasil diperbarui');
|
||||
}
|
||||
|
||||
public function destroy(Buku $buku)
|
||||
{
|
||||
$buku->delete();
|
||||
|
||||
return redirect()
|
||||
->route('admin.buku.index')
|
||||
->with('success', 'Data buku berhasil dihapus');
|
||||
}
|
||||
|
||||
public function cetakPDF()
|
||||
{
|
||||
$bukus = Buku::orderBy('judul')->get();
|
||||
|
||||
$pdf = Pdf::loadView('buku.laporan', compact('bukus'))
|
||||
->setPaper('a4', 'portrait');
|
||||
|
||||
return $pdf->download('laporan_buku.pdf');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\BukuTamu;
|
||||
use App\Models\Anggota;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BukuTamuController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('buku_tamu.index');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
if ($request->tipe === 'member') {
|
||||
// Jalur member: lookup dari anggotas
|
||||
$request->validate([
|
||||
'no_anggota' => 'required',
|
||||
'keperluan' => 'required',
|
||||
]);
|
||||
|
||||
$anggota = Anggota::where('no_identitas', $request->no_anggota)->first();
|
||||
|
||||
if (!$anggota) {
|
||||
return back()->withErrors(['no_anggota' => 'Nomor Anggota tidak ditemukan dalam sistem kami.'])->withInput();
|
||||
}
|
||||
|
||||
// Cari user terkait untuk id_user
|
||||
$user = DB::table('users')->where('name', $anggota->nama)->first();
|
||||
|
||||
BukuTamu::create([
|
||||
'id_user' => $user?->id,
|
||||
'tujuan_kunjungan' => $request->keperluan,
|
||||
'tanggal_kunjungan' => now()->toDateString(),
|
||||
]);
|
||||
|
||||
return redirect()->route('home')->with([
|
||||
'status' => 'Halo ' . $anggota->nama . ', berhasil check-in!',
|
||||
'show_popup' => true,
|
||||
]);
|
||||
|
||||
} else {
|
||||
// Jalur tamu: isi manual
|
||||
$request->validate([
|
||||
'nama_tamu' => 'required|string|max:255',
|
||||
'email' => 'nullable|email|max:255',
|
||||
'no_hp' => 'nullable|string|max:20',
|
||||
'asal_instansi' => 'required|string|max:255',
|
||||
'status' => 'nullable|string|max:255',
|
||||
'keperluan' => 'required',
|
||||
]);
|
||||
|
||||
BukuTamu::create([
|
||||
'nama_tamu' => $request->nama_tamu,
|
||||
'email' => $request->email,
|
||||
'no_hp' => $request->no_hp,
|
||||
'status' => $request->status,
|
||||
'asal_instansi' => $request->asal_instansi,
|
||||
'tujuan_kunjungan' => $request->keperluan,
|
||||
'tanggal_kunjungan' => now()->toDateString(),
|
||||
]);
|
||||
|
||||
return redirect()->route('home')->with([
|
||||
'status' => 'Halo ' . $request->nama_tamu . ', berhasil check-in!',
|
||||
'show_popup' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function adminList()
|
||||
{
|
||||
$bukuTamu = BukuTamu::with('user')
|
||||
->orderBy('tanggal_kunjungan', 'desc')
|
||||
->paginate(10);
|
||||
|
||||
return view('buku_tamu.admin', compact('bukuTamu'));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\BukuTamu;
|
||||
use App\Models\Peminjaman;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LaporanController extends Controller
|
||||
{
|
||||
public function kehadiran()
|
||||
{
|
||||
$bukuTamu = BukuTamu::with('user')
|
||||
->orderBy('tanggal_kunjungan', 'desc')
|
||||
->get();
|
||||
|
||||
return view('laporan.kehadiran', compact('bukuTamu'));
|
||||
}
|
||||
|
||||
public function peminjaman(Request $request)
|
||||
{
|
||||
$query = Peminjaman::with(['anggota', 'user', 'buku'])->orderBy('tanggal_pinjam', 'desc');
|
||||
|
||||
// Optional filtering by month/year if needed (can be added later)
|
||||
|
||||
$peminjaman = $query->get();
|
||||
|
||||
return view('laporan.peminjaman', compact('peminjaman'));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Peminjaman;
|
||||
use App\Models\Anggota;
|
||||
use App\Models\Buku;
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class PeminjamanController extends Controller
|
||||
{
|
||||
public function index(\Illuminate\Http\Request $request)
|
||||
{
|
||||
$search = $request->input('search');
|
||||
|
||||
$query = Peminjaman::with(['anggota', 'user', 'buku'])->latest();
|
||||
|
||||
if ($search) {
|
||||
$searchTerm = strtolower($search);
|
||||
$query->where(function ($q) use ($searchTerm) {
|
||||
$q->whereHas('anggota', function ($qMember) use ($searchTerm) {
|
||||
$qMember->whereRaw('LOWER(nama) LIKE ?', ["%{$searchTerm}%"]);
|
||||
})->orWhereHas('buku', function ($qBuku) use ($searchTerm) {
|
||||
$qBuku->whereRaw('LOWER(judul) LIKE ?', ["%{$searchTerm}%"]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$peminjaman = $query->paginate(15)->appends(['search' => $search]);
|
||||
$buku = Buku::where('eksemplar', '>', 0)->get();
|
||||
$anggota = Anggota::all();
|
||||
return view('admin.peminjaman.index', compact('peminjaman', 'buku', 'anggota', 'search'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$anggota = Anggota::all();
|
||||
$bukus = Buku::all();
|
||||
return view('admin.peminjaman.create', compact('anggota', 'bukus'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
// 1. Validasi input
|
||||
$request->validate([
|
||||
'id_anggota' => 'required|exists:anggotas,id',
|
||||
'id_buku' => 'required|exists:buku,id_buku',
|
||||
'tanggal_pinjam' => 'required|date',
|
||||
'tanggal_kembali' => 'required|date|after_or_equal:tanggal_pinjam',
|
||||
]);
|
||||
|
||||
// 2. Cek dan kurangi stok buku
|
||||
$buku = Buku::findOrFail($request->id_buku);
|
||||
if ($buku->eksemplar <= 0) {
|
||||
return back()->withErrors(['id_buku' => 'Stok buku habis!'])->withInput();
|
||||
}
|
||||
$buku->decrement('eksemplar');
|
||||
|
||||
// 3. Simpan data peminjaman ke database
|
||||
$peminjaman = Peminjaman::create([
|
||||
'id_anggota' => $request->id_anggota,
|
||||
'id_buku' => $request->id_buku,
|
||||
'tanggal_pinjam' => $request->tanggal_pinjam,
|
||||
'tanggal_kembali' => $request->tanggal_kembali,
|
||||
'status_peminjaman' => 'Dipinjam',
|
||||
]);
|
||||
|
||||
// Muat relasi untuk mendapatkan data anggota (seperti no_hp) dan buku untuk keperluan struk PDF
|
||||
$peminjaman->load(['anggota', 'buku']);
|
||||
|
||||
$waSuccess = false;
|
||||
|
||||
// 4. Proses render PDF & Kirim Fonnte dengan Exception Handling
|
||||
try {
|
||||
// Tentukan direktori penyimpanan sementara (temp)
|
||||
$tempDir = storage_path('app/public/temp');
|
||||
|
||||
// Jika foldernya belum ada, buat foldernya terlebih dahulu.
|
||||
if (!file_exists($tempDir)) {
|
||||
mkdir($tempDir, 0755, true);
|
||||
}
|
||||
|
||||
// Buat nama file unik (agar tidak masalah saat request bersamaan)
|
||||
$fileName = 'struk_peminjaman_' . $peminjaman->id . '_' . time() . '.pdf';
|
||||
$filePath = $tempDir . '/' . $fileName;
|
||||
|
||||
// Generate dokumen PDF dari view yang sudah ada
|
||||
$pdf = Pdf::loadView('admin.peminjaman.struk', compact('peminjaman'));
|
||||
|
||||
// Simpan PDF sementara
|
||||
$pdf->save($filePath);
|
||||
|
||||
// Dapatkan nomor handphone pendaftar & Fonnte Token
|
||||
$targetNum = $peminjaman->anggota->no_hp ?? '';
|
||||
$fonnteToken = env('vpzqxF2ZGgTGz9F5UbUS'); // Pastikan token fonnte dimasukkan di file .env Anda.
|
||||
|
||||
// Standarisasi Format Nomor ke awalan 62 (Kode Internasional Indonesia) standar yang dianjurkan Fonnte
|
||||
if (!empty($targetNum)) {
|
||||
$targetNum = preg_replace('/^0/', '62', trim($targetNum));
|
||||
}
|
||||
|
||||
|
||||
// Jika token terisi & nomor HP valid, jalankan request ke service API Fonnte
|
||||
if (!empty($targetNum) && !empty($fonnteToken)) {
|
||||
// Gunakan attach() untuk menyisipkan file PDF dari folder temp
|
||||
$response = Http::withoutVerifying()->timeout(15)->withHeaders([
|
||||
'Authorization' => $fonnteToken,
|
||||
])->attach('file', file_get_contents($filePath), $fileName)->post('https://api.fonnte.com/send', [
|
||||
'target' => $targetNum,
|
||||
'message' => "Halo Kak *{$peminjaman->anggota->nama}*! 📚✨\n\nTerima kasih telah meminjam buku di *Perpustakaan Daerah Jember*.\n\nBersama pesan ini, kami lampirkan file e-Struk (PDF) untuk peminjaman buku:\n📖 Judul: _{$peminjaman->buku->judul}_\n📅 Batas Kembali: *{$peminjaman->tanggal_kembali}*\n\nMohon simpan dokumen PDF ini sebagai bukti transaksi yang sah. Harap kembalikan buku tepat waktu untuk menghindari denda keterlambatan.\n\nSelamat menikmati waktu membaca Anda!\n\nSalam Literasi,\n*Sistem Sarakata Jember*"
|
||||
]);
|
||||
|
||||
// Cek respon resmi fonnte API
|
||||
if ($response->successful() && ($response->json('status') == true)) {
|
||||
$waSuccess = true;
|
||||
} else {
|
||||
\Illuminate\Support\Facades\Log::warning("Fonnte Log: Gagal Terkirim", ['body' => $response->body()]);
|
||||
}
|
||||
} else {
|
||||
Log::warning('Fonnte Log: Token / No HP kosong (Pesan tidak diproses).');
|
||||
}
|
||||
|
||||
// 5. Cleanup Darurat File PDF Secara Otomatis
|
||||
if (file_exists($filePath)) {
|
||||
unlink($filePath);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Bila error (misal: memori PDF kurang, library dompdf crash, timeout dari Fonnte)
|
||||
// Error ditangkap agar sistem tidak langsung menampilkan layar error 500 ke User.
|
||||
Log::error("Error PDF/WA Pengiriman: " . $e->getMessage());
|
||||
|
||||
// Pembersihan ekstra bila error terjadi saat file sudah diciptakan di temp folder, tapi belum dieksekusi unlink di dalam block atas.
|
||||
if (isset($filePath) && file_exists($filePath)) {
|
||||
unlink($filePath);
|
||||
}
|
||||
}
|
||||
|
||||
// Notifikasi Balikan Final ke User
|
||||
$alertSuccessMessage = 'Transaksi peminjaman berhasil direkap.';
|
||||
$alertSuccessMessage .= $waSuccess ? ' Struk WA berhasil terkirim kepada Anggota.' : ' (Namun e-Struk belum sempat terkirim via WA, silakan cek Logs).';
|
||||
|
||||
return redirect()->route('admin.peminjaman.index')->with('success', $alertSuccessMessage);
|
||||
}
|
||||
public function kembali(Peminjaman $peminjaman)
|
||||
{
|
||||
$tglTenggat = \Carbon\Carbon::parse($peminjaman->tanggal_kembali)->startOfDay();
|
||||
$tglSekarang = \Carbon\Carbon::now()->startOfDay();
|
||||
|
||||
$denda = 0;
|
||||
if ($tglSekarang->gt($tglTenggat)) {
|
||||
$selisihHari = $tglSekarang->diffInDays($tglTenggat);
|
||||
$denda = $selisihHari * 1000;
|
||||
}
|
||||
|
||||
$peminjaman->update([
|
||||
'status_peminjaman' => 'Dikembalikan',
|
||||
'tanggal_dikembalikan' => now(),
|
||||
'denda' => $denda
|
||||
]);
|
||||
|
||||
if ($peminjaman->buku) {
|
||||
$peminjaman->buku->increment('eksemplar');
|
||||
}
|
||||
|
||||
$pesan = 'Buku berhasil dikembalikan.';
|
||||
if ($denda > 0) {
|
||||
$pesan .= ' Denda keterlambatan Rp ' . number_format($denda, 0, ',', '.');
|
||||
}
|
||||
|
||||
return back()->with('success', $pesan);
|
||||
}
|
||||
|
||||
public function indexPengembalian()
|
||||
{
|
||||
$pengembalian = Peminjaman::where('status_peminjaman', 'Dikembalikan')
|
||||
->with(['anggota', 'user', 'buku'])
|
||||
->orderBy('tanggal_kembali', 'desc')
|
||||
->paginate(10);
|
||||
|
||||
return view('admin.peminjaman.pengembalian', compact('pengembalian'));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\ProfileUpdateRequest;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the user's profile form.
|
||||
*/
|
||||
public function edit(Request $request): View
|
||||
{
|
||||
return view('profile.edit', [
|
||||
'user' => $request->user(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the user's profile information.
|
||||
*/
|
||||
public function update(ProfileUpdateRequest $request): RedirectResponse
|
||||
{
|
||||
$request->user()->fill($request->validated());
|
||||
|
||||
if ($request->user()->isDirty('email')) {
|
||||
$request->user()->email_verified_at = null;
|
||||
}
|
||||
|
||||
$request->user()->save();
|
||||
|
||||
return Redirect::route('profile.edit')->with('status', 'profile-updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the user's account.
|
||||
*/
|
||||
public function destroy(Request $request): RedirectResponse
|
||||
{
|
||||
$request->validateWithBag('userDeletion', [
|
||||
'password' => ['required', 'current_password'],
|
||||
]);
|
||||
|
||||
$user = $request->user();
|
||||
|
||||
Auth::logout();
|
||||
|
||||
$user->delete();
|
||||
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
return Redirect::to('/');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
// Ambil riwayat peminjaman user ini beserta data buku, urutkan dari yang terbaru
|
||||
$peminjaman = $user->peminjaman()->with('buku')->orderByDesc('created_at')->get();
|
||||
|
||||
// Hitung buku yang SEDANG dipinjam saat ini
|
||||
$buku_dipinjam = $peminjaman->where('status_peminjaman', 'Dipinjam')->count();
|
||||
|
||||
return view('user.index', compact('peminjaman', 'buku_dipinjam'));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,242 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Buku;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class VisitorKatalogController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$originalSearch = $request->input('search');
|
||||
|
||||
$bukuPopuler = Buku::withCount('peminjaman')
|
||||
->orderBy('peminjaman_count', 'desc')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
if (empty($originalSearch)) {
|
||||
$buku = Buku::paginate(12);
|
||||
$search = $originalSearch;
|
||||
return view('visitor.katalog.index', compact('buku', 'search', 'bukuPopuler'));
|
||||
}
|
||||
|
||||
// 1. Text Preprocessing (Stopword Removal)
|
||||
// Array stopword bahasa Indonesia sederhana
|
||||
$stopwords = ['buku', 'tentang', 'yang', 'di', 'ke', 'dari', 'mencari', 'untuk', 'dan', 'ini', 'itu', 'adalah', 'pada', 'dengan', 'sebuah', 'cara'];
|
||||
|
||||
// Membersihkan input: mengubah ke lowercase dan membuang karakter non-alphanumeric
|
||||
$cleanInput = preg_replace('/[^\p{L}\p{N}\s]/u', '', strtolower($originalSearch));
|
||||
$words = explode(' ', $cleanInput);
|
||||
|
||||
// Filter stopword
|
||||
$filteredWords = array_filter($words, function($word) use ($stopwords) {
|
||||
return !in_array($word, $stopwords) && trim($word) !== '';
|
||||
});
|
||||
|
||||
// String hasil preprocessing yang murni siap diproses ke Cosine Similarity
|
||||
$processedSearch = implode(' ', $filteredWords);
|
||||
|
||||
if (empty($processedSearch)) {
|
||||
// Jika setelah dibersihkan query pencarian menjadi kosong (misal pencarian hanya "buku tentang")
|
||||
$buku = new \Illuminate\Pagination\LengthAwarePaginator([], 0, 12, 1, ['path' => $request->url(), 'query' => $request->query()]);
|
||||
$search = $originalSearch;
|
||||
return view('visitor.katalog.index', compact('buku', 'search', 'bukuPopuler'));
|
||||
}
|
||||
|
||||
// 2. Ambil semua buku untuk discoring
|
||||
// Karena Cosine Similarity memerlukan pembandingan tiap data terhadap string pencarian
|
||||
$semuaBuku = Buku::with('kategori')->get();
|
||||
$hasil = [];
|
||||
|
||||
foreach ($semuaBuku as $b) {
|
||||
// Hitung nilai Cosine Similarity untuk masing-masing atribut berdasarkan kata kunci yang sudah dibersihkan
|
||||
$judulSimilarity = $this->calculateSimilarity($processedSearch, $b->judul);
|
||||
$pengarangSimilarity = $this->calculateSimilarity($processedSearch, $b->pengarang);
|
||||
|
||||
// Gabungkan penerbit, deskripsi, dan kategori sebagai atribut teks tambahan
|
||||
$teksTambahan = trim(($b->penerbit ?? '') . ' ' . ($b->deskripsi ?? '') . ' ' . ($b->kategori->nama_kategori ?? ''));
|
||||
$tambahanSimilarity = $this->calculateSimilarity($processedSearch, $teksTambahan);
|
||||
|
||||
// Penyesuaian Bobot WTS (Weighting)
|
||||
// Judul (70%), Pengarang (20%), Penerbit/Deskripsi/Kategori (10%)
|
||||
$totalScore = ($judulSimilarity * 0.7) + ($pengarangSimilarity * 0.2) + ($tambahanSimilarity * 0.1);
|
||||
|
||||
// 3. Penetapan Batas Relevansi (Threshold)
|
||||
// Hanya tampilkan yang memiliki Total Similarity Score >= 0.3 (30%)
|
||||
if ($totalScore >= 0.3) {
|
||||
$b->similarity_score = $totalScore;
|
||||
$hasil[] = $b;
|
||||
}
|
||||
}
|
||||
|
||||
// Urutkan berdasarkan similarity_score terbesar (descending)
|
||||
usort($hasil, function($a, $b) {
|
||||
return $b->similarity_score <=> $a->similarity_score;
|
||||
});
|
||||
|
||||
// 4. Buat manual LengthAwarePaginator untuk memecah hasil dan merender pagination view
|
||||
$currentPage = \Illuminate\Pagination\Paginator::resolveCurrentPage();
|
||||
$perPage = 12;
|
||||
$currentItems = array_slice($hasil, ($currentPage - 1) * $perPage, $perPage);
|
||||
$buku = new \Illuminate\Pagination\LengthAwarePaginator($currentItems, count($hasil), $perPage, $currentPage, [
|
||||
'path' => $request->url(),
|
||||
'query' => $request->query()
|
||||
]);
|
||||
|
||||
$search = $originalSearch; // Kembalikan search asli ke search bar agar tidak membingungkan user
|
||||
return view('visitor.katalog.index', compact('buku', 'search', 'bukuPopuler'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper untuk menghitung nilai perbandingan kemiripan teks.
|
||||
* Menggunakan pendekatan Cosine Similarity yang dimodifikasi (Query Coverage)
|
||||
* agar panjang judul buku tidak menurunkan skor secara drastis
|
||||
* pada pencarian kata kunci pendek.
|
||||
*/
|
||||
private function calculateSimilarity($query, $text)
|
||||
{
|
||||
if (empty(trim($text))) return 0;
|
||||
|
||||
$queryWords = explode(' ', strtolower(preg_replace('/[^\p{L}\p{N}\s]/u', '', $query)));
|
||||
$textWords = explode(' ', strtolower(preg_replace('/[^\p{L}\p{N}\s]/u', '', $text)));
|
||||
|
||||
// Frekuensi kata
|
||||
$vecA = array_count_values(array_filter($queryWords));
|
||||
$vecB = array_count_values(array_filter($textWords));
|
||||
|
||||
$terms = array_unique(array_merge(array_keys($vecA), array_keys($vecB)));
|
||||
|
||||
$dotProduct = 0;
|
||||
$normA = 0;
|
||||
$normB = 0;
|
||||
|
||||
foreach ($terms as $term) {
|
||||
$valA = $vecA[$term] ?? 0;
|
||||
$valB = $vecB[$term] ?? 0;
|
||||
|
||||
$dotProduct += ($valA * $valB);
|
||||
$normA += pow($valA, 2);
|
||||
$normB += pow($valB, 2);
|
||||
}
|
||||
|
||||
if ($normA == 0 || $normB == 0) return 0;
|
||||
|
||||
// Standard Cosine Similarity: $dotProduct / (sqrt($normA) * sqrt($normB))
|
||||
// Kelemahannya: Jika judul buku sangat panjang (normB besar), skor akan anjlok (misal < 0.2)
|
||||
// padahal kata pencariannya cocok 100%.
|
||||
// Modifikasi menjadi Query Coverage (Pembagi dominan adalah panjang query).
|
||||
return $dotProduct / $normA;
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$buku = Buku::with(['kategori', 'peminjaman.user'])->findOrFail($id);
|
||||
$lokasi = $this->prediksiLokasiRak($buku->nomor_panggil);
|
||||
$rekomendasi = $this->getRekomendasi($buku);
|
||||
|
||||
return view('visitor.katalog.show', compact('buku', 'lokasi', 'rekomendasi'));
|
||||
}
|
||||
|
||||
private function getRekomendasi($targetBuku)
|
||||
{
|
||||
$semuaBuku = Buku::where('id_buku', '!=', $targetBuku->id_buku)
|
||||
->whereNotNull('nomor_panggil')
|
||||
->get();
|
||||
|
||||
$hasil = [];
|
||||
$targetDdc = substr(preg_replace('/[^0-9]/', '', $targetBuku->nomor_panggil), 0, 3);
|
||||
|
||||
if (strlen($targetDdc) < 3) {
|
||||
return collect([]);
|
||||
}
|
||||
|
||||
foreach ($semuaBuku as $b) {
|
||||
$pembandingDdc = substr(preg_replace('/[^0-9]/', '', $b->nomor_panggil), 0, 3);
|
||||
if (strlen($pembandingDdc) < 3) continue;
|
||||
|
||||
$skor = 0;
|
||||
if ($targetDdc[0] === $pembandingDdc[0]) {
|
||||
$skor += 0.2;
|
||||
if ($targetDdc[1] === $pembandingDdc[1]) {
|
||||
$skor += 0.3;
|
||||
if ($targetDdc[2] === $pembandingDdc[2]) {
|
||||
$skor += 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($skor > 0) {
|
||||
$b->similarity_score = $skor;
|
||||
$hasil[] = $b;
|
||||
}
|
||||
}
|
||||
|
||||
usort($hasil, function($a, $b) {
|
||||
return $b->similarity_score <=> $a->similarity_score;
|
||||
});
|
||||
|
||||
return collect(array_slice($hasil, 0, 4));
|
||||
}
|
||||
|
||||
private function prediksiLokasiRak($nomor_panggil)
|
||||
{
|
||||
if (empty($nomor_panggil)) {
|
||||
return ['rak' => 'Tidak Diketahui', 'area' => 'Hubungi Petugas', 'kode_rak' => 'none'];
|
||||
}
|
||||
|
||||
$kode_utama = (int) substr(trim($nomor_panggil), 0, 3);
|
||||
|
||||
return match (true) {
|
||||
$kode_utama >= 0 && $kode_utama <= 99 => match(true) {
|
||||
$kode_utama <= 19 => ['rak' => 'Rak 01', 'area' => 'Karya Umum (Bibliografi)', 'kode_rak' => 'rak_000'],
|
||||
$kode_utama <= 50 => ['rak' => 'Rak 02', 'area' => 'Karya Umum (Ensiklopedia)', 'kode_rak' => 'rak_000'],
|
||||
default => ['rak' => 'Rak 03-05', 'area' => 'Karya Umum Lainnya', 'kode_rak' => 'rak_000'],
|
||||
},
|
||||
|
||||
$kode_utama >= 100 && $kode_utama <= 199 => match(true) {
|
||||
$kode_utama <= 150 => ['rak' => 'Rak 06-10', 'area' => 'Filsafat', 'kode_rak' => 'rak_100'],
|
||||
default => ['rak' => 'Rak 11-14', 'area' => 'Psikologi', 'kode_rak' => 'rak_100'],
|
||||
},
|
||||
|
||||
$kode_utama >= 200 && $kode_utama <= 299 => match(true) {
|
||||
$kode_utama == 297 => ['rak' => 'Rak 25-32', 'area' => 'Agama Islam', 'kode_rak' => 'rak_200'],
|
||||
default => ['rak' => 'Rak 15-24', 'area' => 'Agama Umum & Lainnya', 'kode_rak' => 'rak_200'],
|
||||
},
|
||||
|
||||
$kode_utama >= 300 && $kode_utama <= 399 => match(true) {
|
||||
$kode_utama <= 330 => ['rak' => 'Rak 33-36', 'area' => 'Sosiologi & Ilmu Politik', 'kode_rak' => 'rak_300'],
|
||||
$kode_utama <= 360 => ['rak' => 'Rak 37-40', 'area' => 'Ekonomi & Hukum', 'kode_rak' => 'rak_300'],
|
||||
default => ['rak' => 'Rak 41-44', 'area' => 'Pendidikan & Adat', 'kode_rak' => 'rak_300'],
|
||||
},
|
||||
|
||||
$kode_utama >= 400 && $kode_utama <= 499 => ['rak' => 'Rak 45', 'area' => 'Bahasa', 'kode_rak' => 'rak_400'],
|
||||
|
||||
$kode_utama >= 500 && $kode_utama <= 599 => ['rak' => 'Rak 46-48', 'area' => 'Ilmu Murni', 'kode_rak' => 'rak_500'],
|
||||
|
||||
$kode_utama >= 600 && $kode_utama <= 699 => match(true) {
|
||||
$kode_utama <= 610 => ['rak' => 'Rak 49-53', 'area' => 'Ilmu Kedokteran', 'kode_rak' => 'rak_600'],
|
||||
$kode_utama <= 630 => ['rak' => 'Rak 54-58', 'area' => 'Ilmu Teknik', 'kode_rak' => 'rak_600'],
|
||||
$kode_utama <= 650 => ['rak' => 'Rak 59-63', 'area' => 'Pertanian', 'kode_rak' => 'rak_600'],
|
||||
default => ['rak' => 'Rak 64-68', 'area' => 'Manajemen & Bisnis', 'kode_rak' => 'rak_600'],
|
||||
},
|
||||
|
||||
$kode_utama >= 700 && $kode_utama <= 799 => match(true) {
|
||||
$kode_utama <= 739 => ['rak' => 'Rak 71', 'area' => 'Kesenian Murni', 'kode_rak' => 'rak_700'],
|
||||
$kode_utama <= 769 => ['rak' => 'Rak 72', 'area' => 'Seni Rupa & Kriya', 'kode_rak' => 'rak_700'],
|
||||
$kode_utama <= 789 => ['rak' => 'Rak 73', 'area' => 'Fotografi & Musik', 'kode_rak' => 'rak_700'],
|
||||
default => ['rak' => 'Rak 74', 'area' => 'Olahraga & Hiburan', 'kode_rak' => 'rak_700'],
|
||||
},
|
||||
|
||||
$kode_utama >= 800 && $kode_utama <= 899 => ['rak' => 'Rak 77-79', 'area' => 'Kesusastraan (Sastra)', 'kode_rak' => 'rak_800'],
|
||||
|
||||
$kode_utama >= 900 && $kode_utama <= 999 => match(true) {
|
||||
$kode_utama <= 919 => ['rak' => 'Rak 69, 70', 'area' => 'Geografi & Perjalanan', 'kode_rak' => 'rak_900'],
|
||||
default => ['rak' => 'Rak 80-84', 'area' => 'Sejarah Umum', 'kode_rak' => 'rak_900'],
|
||||
},
|
||||
|
||||
default => ['rak' => 'Rak 75-76', 'area' => 'Koleksi Terbaru', 'kode_rak' => 'rak_baru'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class WelcomeController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
// Menampilkan 4 buku rilis baru berdasarkan tahun terbit terbaru
|
||||
$bukuTerbaru = \App\Models\Buku::whereNotNull('tahun_terbit')
|
||||
->orderBy('tahun_terbit', 'desc')
|
||||
->orderBy('id_buku', 'desc')
|
||||
->limit(4)
|
||||
->get();
|
||||
|
||||
// 5 Buku Paling Banyak Dipinjam
|
||||
$bukuPopuler = \App\Models\Buku::withCount('peminjaman')
|
||||
->orderBy('peminjaman_count', 'desc')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
return view('welcome', compact('bukuTerbaru', 'bukuPopuler'));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AdminMiddleware
|
||||
{
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
// Cek apakah user sudah login dan apakah role-nya 'admin'
|
||||
if (!auth()->check() || auth()->user()->role !== 'admin') {
|
||||
return redirect('/')->with('error', 'Anda tidak memiliki akses admin.');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use Illuminate\Auth\Events\Lockout;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class LoginRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'email' => ['required', 'string', 'email'],
|
||||
'password' => ['required', 'string'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to authenticate the request's credentials.
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function authenticate(): void
|
||||
{
|
||||
$this->ensureIsNotRateLimited();
|
||||
|
||||
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
|
||||
RateLimiter::hit($this->throttleKey());
|
||||
|
||||
throw ValidationException::withMessages([
|
||||
'email' => __('Email atau password salah.'),
|
||||
]);
|
||||
}
|
||||
|
||||
RateLimiter::clear($this->throttleKey());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ensure the login request is not rate limited.
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function ensureIsNotRateLimited(): void
|
||||
{
|
||||
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event(new Lockout($this));
|
||||
|
||||
$seconds = RateLimiter::availableIn($this->throttleKey());
|
||||
|
||||
throw ValidationException::withMessages([
|
||||
'email' => trans('auth.throttle', [
|
||||
'seconds' => $seconds,
|
||||
'minutes' => ceil($seconds / 60),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the rate limiting throttle key for the request.
|
||||
*/
|
||||
public function throttleKey(): string
|
||||
{
|
||||
return Str::transliterate(Str::lower($this->string('email')).'|'.$this->ip());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class ProfileUpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => [
|
||||
'required',
|
||||
'string',
|
||||
'lowercase',
|
||||
'email',
|
||||
'max:255',
|
||||
Rule::unique(User::class)->ignore($this->user()->id),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Anggota extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'nama',
|
||||
'no_identitas',
|
||||
'jenis_anggota',
|
||||
'no_ktp',
|
||||
'prodi',
|
||||
'no_hp',
|
||||
'alamat',
|
||||
'nama_wali',
|
||||
'no_hp_wali',
|
||||
'hubungan_wali',
|
||||
];
|
||||
|
||||
public function peminjaman()
|
||||
{
|
||||
return $this->hasMany(Peminjaman::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Buku extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'buku';
|
||||
protected $primaryKey = 'id_buku';
|
||||
|
||||
protected $fillable = [
|
||||
'bibid',
|
||||
'judul',
|
||||
'edisi',
|
||||
'penerbit',
|
||||
'tahun_terbit',
|
||||
'deskripsi_fisik',
|
||||
'pengarang',
|
||||
'nomor_panggil',
|
||||
'konten_digital',
|
||||
'eksemplar',
|
||||
'id_kategori',
|
||||
'cover',
|
||||
'lokasi_x',
|
||||
'lokasi_y',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'lokasi_x' => 'float',
|
||||
'lokasi_y' => 'float',
|
||||
];
|
||||
|
||||
public function peminjaman()
|
||||
{
|
||||
return $this->hasMany(Peminjaman::class, 'id_buku');
|
||||
}
|
||||
|
||||
public function kategori()
|
||||
{
|
||||
return $this->belongsTo(Kategori::class, 'id_kategori', 'id_kategori');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BukuTamu extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'buku_tamu';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'id_user',
|
||||
'nama_tamu',
|
||||
'email',
|
||||
'no_hp',
|
||||
'asal_instansi',
|
||||
'status',
|
||||
'tujuan_kunjungan',
|
||||
'tanggal_kunjungan',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'id_user');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Kategori extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'kategori';
|
||||
protected $primaryKey = 'id_kategori';
|
||||
|
||||
protected $fillable = [
|
||||
'nama_kategori',
|
||||
];
|
||||
|
||||
public function buku()
|
||||
{
|
||||
return $this->hasMany(Buku::class, 'id_kategori', 'id_kategori');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\User;
|
||||
use App\Models\Buku;
|
||||
|
||||
class Peminjaman extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'peminjaman';
|
||||
protected $primaryKey = 'id_peminjaman';
|
||||
|
||||
protected $fillable = [
|
||||
'id_user',
|
||||
'id_anggota',
|
||||
'id_buku',
|
||||
'tanggal_pinjam',
|
||||
'tanggal_kembali',
|
||||
'tanggal_dikembalikan',
|
||||
'denda',
|
||||
'status_peminjaman',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'id_user');
|
||||
}
|
||||
|
||||
public function anggota()
|
||||
{
|
||||
return $this->belongsTo(Anggota::class, 'id_anggota');
|
||||
}
|
||||
|
||||
public function buku()
|
||||
{
|
||||
return $this->belongsTo(Buku::class, 'id_buku');
|
||||
}
|
||||
|
||||
/**
|
||||
* Hitung denda dinamis (Accessor: $peminjaman->total_denda)
|
||||
*/
|
||||
public function getTotalDendaAttribute()
|
||||
{
|
||||
$tarif = 1000; // Tarif 1.000 per hari keterlambatan
|
||||
$denda = 0;
|
||||
|
||||
if (!$this->tanggal_kembali) return 0;
|
||||
|
||||
$tgl_kembali = \Carbon\Carbon::parse($this->tanggal_kembali)->startOfDay();
|
||||
|
||||
if ($this->status_peminjaman === 'Dikembalikan' && $this->tanggal_dikembalikan) {
|
||||
$tgl_dikembalikan = \Carbon\Carbon::parse($this->tanggal_dikembalikan)->startOfDay();
|
||||
if ($tgl_dikembalikan->greaterThan($tgl_kembali)) {
|
||||
$selisih = $tgl_kembali->diffInDays($tgl_dikembalikan);
|
||||
$denda = $selisih * $tarif;
|
||||
}
|
||||
} elseif ($this->status_peminjaman === 'Dipinjam') {
|
||||
$hari_ini = \Carbon\Carbon::now()->startOfDay();
|
||||
if ($hari_ini->greaterThan($tgl_kembali)) {
|
||||
$selisih = $tgl_kembali->diffInDays($hari_ini);
|
||||
$denda = $selisih * $tarif;
|
||||
}
|
||||
}
|
||||
|
||||
// Return denda kalkulasi atau denda yg sudah tersimpan (jika manual admin entry)
|
||||
return max($denda, $this->attributes['denda'] ?? 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'no_hp',
|
||||
'instansi',
|
||||
'status',
|
||||
'no_ktp',
|
||||
'alasan',
|
||||
'role',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the peminjaman for the user.
|
||||
*/
|
||||
public function peminjaman()
|
||||
{
|
||||
return $this->hasMany(Peminjaman::class, 'id_user', 'id');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Jalur ke halaman utama setelah login / register berhasil.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/dashboard';
|
||||
|
||||
/**
|
||||
* Daftarkan layanan rute untuk aplikasi.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
// Atur batas kecepatan API (opsional)
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
|
||||
// Definisikan rute aplikasi
|
||||
$this->routes(function () {
|
||||
Route::middleware('api')
|
||||
->prefix('api')
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class AppLayout extends Component
|
||||
{
|
||||
/**
|
||||
* Get the view / contents that represents the component.
|
||||
*/
|
||||
public function render(): View
|
||||
{
|
||||
return view('layouts.app');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class GuestLayout extends Component
|
||||
{
|
||||
/**
|
||||
* Get the view / contents that represents the component.
|
||||
*/
|
||||
public function render(): View
|
||||
{
|
||||
return view('layouts.guest');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
// Register the Composer autoloader...
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
// Bootstrap Laravel and handle the command...
|
||||
/** @var Application $app */
|
||||
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||
|
||||
$status = $app->handleCommand(new ArgvInput);
|
||||
|
||||
exit($status);
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
web: __DIR__.'/../routes/web.php',
|
||||
commands: __DIR__.'/../routes/console.php',
|
||||
health: '/up',
|
||||
)
|
||||
->withMiddleware(function ($middleware) {
|
||||
$middleware->alias([
|
||||
'admin' => \App\Http\Middleware\AdminMiddleware::class,
|
||||
]);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions): void {
|
||||
//
|
||||
|
||||
})->create();
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
App\Providers\AppServiceProvider::class,
|
||||
];
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
{
|
||||
"$schema": "https://getcomposer.org/schema.json",
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The skeleton application for the Laravel framework.",
|
||||
"keywords": ["laravel", "framework"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"barryvdh/laravel-dompdf": "^3.1",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/tinker": "^2.10.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.23",
|
||||
"laravel/breeze": "^2.3",
|
||||
"laravel/pail": "^1.2.2",
|
||||
"laravel/pint": "^1.24",
|
||||
"laravel/sail": "^1.41",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.6",
|
||||
"phpunit/phpunit": "^11.5.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"setup": [
|
||||
"composer install",
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
|
||||
"@php artisan key:generate",
|
||||
"@php artisan migrate --force",
|
||||
"npm install",
|
||||
"npm run build"
|
||||
],
|
||||
"dev": [
|
||||
"Composer\\Config::disableProcessTimeout",
|
||||
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
|
||||
],
|
||||
"test": [
|
||||
"@php artisan config:clear --ansi",
|
||||
"@php artisan test"
|
||||
],
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi",
|
||||
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
|
||||
"@php artisan migrate --graceful --ansi"
|
||||
],
|
||||
"pre-package-uninstall": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true,
|
||||
"php-http/discovery": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,126 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application, which will be used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| other UI elements where an application name needs to be displayed.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| the application so that it's available within Artisan commands.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. The timezone
|
||||
| is set to "UTC" by default as it is suitable for most use cases.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'UTC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by Laravel's translation / localization methods. This option can be
|
||||
| set to any locale for which you plan to have translation strings.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => env('APP_LOCALE', 'id'),
|
||||
|
||||
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'id'),
|
||||
|
||||
'faker_locale' => env('APP_FAKER_LOCALE', 'id_ID'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is utilized by Laravel's encryption services and should be set
|
||||
| to a random, 32 character string to ensure that all encrypted values
|
||||
| are secure. You should do this prior to deploying the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
||||
'previous_keys' => [
|
||||
...array_filter(
|
||||
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
|
||||
),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maintenance Mode Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options determine the driver used to determine and
|
||||
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||
| allow maintenance mode to be controlled across multiple machines.
|
||||
|
|
||||
| Supported drivers: "file", "cache"
|
||||
|
|
||||
*/
|
||||
|
||||
'maintenance' => [
|
||||
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
|
||||
'store' => env('APP_MAINTENANCE_STORE', 'database'),
|
||||
],
|
||||
|
||||
];
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default authentication "guard" and password
|
||||
| reset "broker" for your application. You may change these values
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => env('AUTH_GUARD', 'web'),
|
||||
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| which utilizes session storage plus the Eloquent user provider.
|
||||
|
|
||||
| All authentication guards have a user provider, which defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| system used by the application. Typically, Eloquent is utilized.
|
||||
|
|
||||
| Supported: "session"
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication guards have a user provider, which defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| system used by the application. Typically, Eloquent is utilized.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| providers to represent the model / table. These providers may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => env('AUTH_MODEL', App\Models\User::class),
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options specify the behavior of Laravel's password
|
||||
| reset functionality, including the table utilized for token storage
|
||||
| and the user provider that is invoked to actually retrieve users.
|
||||
|
|
||||
| The expiry time is the number of minutes that each reset token will be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
| The throttle setting is the number of seconds a user must wait before
|
||||
| generating more password reset tokens. This prevents the user from
|
||||
| quickly generating a very large amount of password reset tokens.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the number of seconds before a password confirmation
|
||||
| window expires and users are asked to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
*/
|
||||
|
||||
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
|
||||
|
||||
];
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache store that will be used by the
|
||||
| framework. This connection is utilized if another isn't explicitly
|
||||
| specified when running a cache operation inside the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_STORE', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
| Supported drivers: "array", "database", "file", "memcached",
|
||||
| "redis", "dynamodb", "octane", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
'serialize' => false,
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'connection' => env('DB_CACHE_CONNECTION'),
|
||||
'table' => env('DB_CACHE_TABLE', 'cache'),
|
||||
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
|
||||
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
'lock_path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
|
||||
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
'octane' => [
|
||||
'driver' => 'octane',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
|
||||
| stores, there might be other applications using the same cache. For
|
||||
| that reason, you may prefix every cache key to avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),
|
||||
|
||||
];
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for database operations. This is
|
||||
| the connection which will be utilized unless another connection
|
||||
| is explicitly specified when you execute a query / statement.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('DB_CONNECTION', 'sqlite'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below are all of the database connections defined for your application.
|
||||
| An example configuration is provided for each database system which
|
||||
| is supported by Laravel. You're free to add / remove connections.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => env('DB_URL'),
|
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
'prefix' => '',
|
||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
'busy_timeout' => null,
|
||||
'journal_mode' => null,
|
||||
'synchronous' => null,
|
||||
'transaction_mode' => 'DEFERRED',
|
||||
],
|
||||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'mariadb' => [
|
||||
'driver' => 'mariadb',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'search_path' => 'public',
|
||||
'sslmode' => 'prefer',
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run on the database.
|
||||
|
|
||||
*/
|
||||
|
||||
'migrations' => [
|
||||
'table' => 'migrations',
|
||||
'update_date_on_publish' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as Memcached. You may define your connection settings here.
|
||||
|
|
||||
*/
|
||||
|
||||
'redis' => [
|
||||
|
||||
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'),
|
||||
'persistent' => env('REDIS_PERSISTENT', false),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application for file storage.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below you may configure as many filesystem disks as necessary, and you
|
||||
| may even configure multiple disks for the same driver. Examples for
|
||||
| most supported storage drivers are configured here for reference.
|
||||
|
|
||||
| Supported drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/private'),
|
||||
'serve' => true,
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Symbolic Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the symbolic links that will be created when the
|
||||
| `storage:link` Artisan command is executed. The array keys should be
|
||||
| the locations of the links and the values should be their targets.
|
||||
|
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
],
|
||||
|
||||
];
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
use Monolog\Processor\PsrLogMessageProcessor;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that is utilized to write
|
||||
| messages to your logs. The value provided here should match one of
|
||||
| the channels present in the list of "channels" configured below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Deprecations Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the log channel that should be used to log warnings
|
||||
| regarding deprecated PHP and library features. This allows you to get
|
||||
| your application ready for upcoming major versions of dependencies.
|
||||
|
|
||||
*/
|
||||
|
||||
'deprecations' => [
|
||||
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Laravel
|
||||
| utilizes the Monolog PHP logging library, which includes a variety
|
||||
| of powerful log handlers and formatters that you're free to use.
|
||||
|
|
||||
| Available drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog", "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'days' => env('LOG_DAILY_DAYS', 14),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
|
||||
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
|
||||
'level' => env('LOG_LEVEL', 'critical'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => StreamHandler::class,
|
||||
'handler_with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Mailer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default mailer that is used to send all email
|
||||
| messages unless another mailer is explicitly specified when sending
|
||||
| the message. All additional mailers can be configured within the
|
||||
| "mailers" array. Examples of each type of mailer are provided.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('MAIL_MAILER', 'log'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mailer Configurations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure all of the mailers used by your application plus
|
||||
| their respective settings. Several examples have been configured for
|
||||
| you and you are free to add your own as your application requires.
|
||||
|
|
||||
| Laravel supports a variety of mail "transport" drivers that can be used
|
||||
| when delivering an email. You may specify which one you're using for
|
||||
| your mailers below. You may also add additional mailers if needed.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||
| "postmark", "resend", "log", "array",
|
||||
| "failover", "roundrobin"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'scheme' => env('MAIL_SCHEME'),
|
||||
'url' => env('MAIL_URL'),
|
||||
'host' => env('MAIL_HOST', '127.0.0.1'),
|
||||
'port' => env('MAIL_PORT', 2525),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
|
||||
// 'client' => [
|
||||
// 'timeout' => 5,
|
||||
// ],
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'transport' => 'resend',
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'transport' => 'failover',
|
||||
'mailers' => [
|
||||
'smtp',
|
||||
'log',
|
||||
],
|
||||
'retry_after' => 60,
|
||||
],
|
||||
|
||||
'roundrobin' => [
|
||||
'transport' => 'roundrobin',
|
||||
'mailers' => [
|
||||
'ses',
|
||||
'postmark',
|
||||
],
|
||||
'retry_after' => 60,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all emails sent by your application to be sent from
|
||||
| the same address. Here you may specify a name and address that is
|
||||
| used globally for all emails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
];
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue supports a variety of backends via a single, unified
|
||||
| API, giving you convenient access to each backend using identical
|
||||
| syntax for each. The default queue connection is defined below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection options for every queue backend
|
||||
| used by your application. An example configuration is provided for
|
||||
| each backend supported by Laravel. You're also free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'connection' => env('DB_QUEUE_CONNECTION'),
|
||||
'table' => env('DB_QUEUE_TABLE', 'jobs'),
|
||||
'queue' => env('DB_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
|
||||
'queue' => env('BEANSTALKD_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => 0,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||
'queue' => env('SQS_QUEUE', 'default'),
|
||||
'suffix' => env('SQS_SUFFIX'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => null,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Job Batching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following options configure the database and table that store job
|
||||
| batching information. These options can be updated to any database
|
||||
| connection and table which has been defined by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'batching' => [
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'job_batches',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control how and where failed jobs are stored. Laravel ships with
|
||||
| support for storing failed jobs in a simple file or in a database.
|
||||
|
|
||||
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'postmark' => [
|
||||
'token' => env('POSTMARK_TOKEN'),
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'key' => env('RESEND_KEY'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'notifications' => [
|
||||
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
|
@ -0,0 +1,217 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines the default session driver that is utilized for
|
||||
| incoming requests. Laravel supports a variety of storage options to
|
||||
| persist session data. Database storage is a great default choice.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "memcached",
|
||||
| "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('SESSION_DRIVER', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to expire immediately when the browser is closed then you may
|
||||
| indicate that via the expire_on_close configuration option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => (int) env('SESSION_LIFETIME', 120),
|
||||
|
||||
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it's stored. All encryption is performed
|
||||
| automatically by Laravel and you may use the session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => env('SESSION_ENCRYPT', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the "file" session driver, the session files are placed
|
||||
| on disk. The default storage location is defined here; however, you
|
||||
| are free to provide another location where they should be stored.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => env('SESSION_CONNECTION'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table to
|
||||
| be used to store sessions. Of course, a sensible default is defined
|
||||
| for you; however, you're welcome to change this to another table.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => env('SESSION_TABLE', 'sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using one of the framework's cache driven session backends, you may
|
||||
| define the cache store which should be used to store the session data
|
||||
| between requests. This must match one of your defined cache stores.
|
||||
|
|
||||
| Affects: "dynamodb", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the session cookie that is created by
|
||||
| the framework. Typically, you should not need to change this value
|
||||
| since doing so does not grant a meaningful security improvement.
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug((string) env('APP_NAME', 'laravel')).'-session'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application, but you're free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => env('SESSION_PATH', '/'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the domain and subdomains the session cookie is
|
||||
| available to. By default, the cookie will be available to the root
|
||||
| domain and all subdomains. Typically, this shouldn't be changed.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('SESSION_DOMAIN'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you when it can't be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. It's unlikely you should disable this option.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => env('SESSION_HTTP_ONLY', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| will set this value to "lax" to permit secure cross-site requests.
|
||||
|
|
||||
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
||||
|
|
||||
| Supported: "lax", "strict", "none", null
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => env('SESSION_SAME_SITE', 'lax'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Partitioned Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will tie the cookie to the top-level site for
|
||||
| a cross-site context. Partitioned cookies are accepted by the browser
|
||||
| when flagged "secure" and the Same-Site attribute is set to "none".
|
||||
|
|
||||
*/
|
||||
|
||||
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
|
||||
|
||||
];
|
||||
|
|
@ -0,0 +1 @@
|
|||
*.sqlite*
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('bukus', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('judul');
|
||||
$table->string('pengarang');
|
||||
$table->string('penerbit');
|
||||
$table->year('tahun_terbit');
|
||||
$table->integer('stok');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('bukus');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('anggotas', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('nama');
|
||||
$table->string('nim')->unique();
|
||||
$table->string('prodi');
|
||||
$table->string('no_hp')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('anggotas');
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('peminjaman', function (Blueprint $table) {
|
||||
$table->increments('id_peminjaman');
|
||||
$table->unsignedBigInteger('id_user');
|
||||
$table->unsignedBigInteger('id_buku');
|
||||
$table->date('tanggal_pinjam')->nullable();
|
||||
$table->date('tanggal_kembali')->nullable();
|
||||
$table->string('status_peminjaman', 20)->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('id_user')->references('id')->on('users')->cascadeOnDelete();
|
||||
$table->foreign('id_buku')->references('id')->on('bukus')->cascadeOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('peminjaman');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('no_hp')->nullable();
|
||||
$table->string('instansi')->nullable();
|
||||
$table->string('status')->nullable(); // Mahasiswa, Dosen, dll
|
||||
$table->string('no_ktp')->nullable();
|
||||
$table->string('alasan')->nullable(); // Tujuan kunjungan
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(['no_hp', 'instansi', 'status', 'no_ktp', 'alasan']);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('role')->default('user')->after('password');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('role');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('peminjaman', function (Blueprint $table) {
|
||||
// Drop old FKs carefully
|
||||
try {
|
||||
DB::statement('ALTER TABLE peminjaman DROP FOREIGN KEY peminjaman_ibfk_1');
|
||||
} catch (\Exception $e) {
|
||||
// Ignore if not exists
|
||||
}
|
||||
|
||||
try {
|
||||
DB::statement('ALTER TABLE peminjaman DROP FOREIGN KEY peminjaman_ibfk_2');
|
||||
} catch (\Exception $e) {
|
||||
// Ignore if not exists
|
||||
}
|
||||
|
||||
// Change column types
|
||||
DB::statement('ALTER TABLE peminjaman MODIFY id_user BIGINT UNSIGNED NOT NULL');
|
||||
DB::statement('ALTER TABLE peminjaman MODIFY id_buku BIGINT UNSIGNED NOT NULL');
|
||||
|
||||
// Add correct foreign keys
|
||||
$table->foreign('id_user')
|
||||
->references('id')
|
||||
->on('users')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign('id_buku')
|
||||
->references('id')
|
||||
->on('bukus')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('peminjaman', function (Blueprint $table) {
|
||||
$table->dropForeign(['id_user']);
|
||||
// We cannot easily recreate the "wrong" FK without knowing exact wrong definition,
|
||||
// but usually we don't need to revert a fix to a broken state.
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('buku_tamu', function (Blueprint $table) {
|
||||
// Drop old FK if exists
|
||||
try {
|
||||
DB::statement('ALTER TABLE buku_tamu DROP FOREIGN KEY buku_tamu_ibfk_1');
|
||||
} catch (\Exception $e) {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
// Change column type
|
||||
DB::statement('ALTER TABLE buku_tamu MODIFY id_user BIGINT UNSIGNED NOT NULL');
|
||||
|
||||
// Add correct FK
|
||||
$table->foreign('id_user')
|
||||
->references('id')
|
||||
->on('users')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('buku_tamu', function (Blueprint $table) {
|
||||
$table->dropForeign(['id_user']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('anggotas', function (Blueprint $table) {
|
||||
// Rename nim → no_identitas (lebih general: NIM/NISN/NIP)
|
||||
$table->renameColumn('nim', 'no_identitas');
|
||||
});
|
||||
|
||||
Schema::table('anggotas', function (Blueprint $table) {
|
||||
// Kolom baru untuk keamanan & akuntabilitas
|
||||
$table->string('jenis_anggota')->after('no_identitas'); // Mahasiswa, Siswa, Dosen, Umum
|
||||
$table->string('no_ktp', 20)->after('jenis_anggota'); // NIK 16 digit
|
||||
$table->text('alamat')->after('no_hp'); // Alamat lengkap
|
||||
$table->string('nama_wali')->after('alamat'); // Nama penjamin
|
||||
$table->string('no_hp_wali', 20)->after('nama_wali'); // No HP penjamin
|
||||
$table->string('hubungan_wali')->after('no_hp_wali'); // Orang Tua / Saudara / dll
|
||||
|
||||
// Prodi jadi nullable (umum/dosen mungkin tidak punya prodi)
|
||||
$table->string('prodi')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('anggotas', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'jenis_anggota', 'no_ktp', 'alamat',
|
||||
'nama_wali', 'no_hp_wali', 'hubungan_wali',
|
||||
]);
|
||||
$table->string('prodi')->nullable(false)->change();
|
||||
});
|
||||
|
||||
Schema::table('anggotas', function (Blueprint $table) {
|
||||
$table->renameColumn('no_identitas', 'nim');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('buku_tamu', function (Blueprint $table) {
|
||||
// id_user jadi nullable (tamu non-member tidak punya user)
|
||||
$table->unsignedBigInteger('id_user')->nullable()->change();
|
||||
|
||||
// Kolom untuk tamu non-member
|
||||
$table->string('nama_tamu')->nullable()->after('id_user');
|
||||
$table->string('asal_instansi')->nullable()->after('nama_tamu');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('buku_tamu', function (Blueprint $table) {
|
||||
$table->dropColumn(['nama_tamu', 'asal_instansi']);
|
||||
$table->unsignedBigInteger('id_user')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('peminjaman', function (Blueprint $table) {
|
||||
$table->date('tanggal_dikembalikan')->nullable()->after('tanggal_kembali');
|
||||
$table->integer('denda')->default(0)->after('tanggal_dikembalikan');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('peminjaman', function (Blueprint $table) {
|
||||
$table->dropColumn(['tanggal_dikembalikan', 'denda']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('peminjaman', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('peminjaman', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('buku_tamu', function (Blueprint $table) {
|
||||
$table->string('email')->nullable()->after('nama_tamu');
|
||||
$table->string('no_hp')->nullable()->after('email');
|
||||
$table->string('status')->nullable()->after('asal_instansi');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('buku_tamu', function (Blueprint $table) {
|
||||
$table->dropColumn(['email', 'no_hp', 'status']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('peminjaman', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('id_anggota')->nullable()->after('id_peminjaman');
|
||||
$table->unsignedBigInteger('id_user')->nullable()->change();
|
||||
|
||||
$table->foreign('id_anggota')->references('id')->on('anggotas')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('peminjaman', function (Blueprint $table) {
|
||||
$table->dropForeign(['id_anggota']);
|
||||
$table->dropColumn('id_anggota');
|
||||
$table->unsignedBigInteger('id_user')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('buku', function (Blueprint $table) {
|
||||
$table->float('lokasi_x')->nullable()->after('cover')->comment('Posisi X pin pada denah (persentase 0-100)');
|
||||
$table->float('lokasi_y')->nullable()->after('lokasi_x')->comment('Posisi Y pin pada denah (persentase 0-100)');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('buku', function (Blueprint $table) {
|
||||
$table->dropColumn(['lokasi_x', 'lokasi_y']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BukuTamuSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// Ambil sembarang user ID
|
||||
$userId = DB::table('users')->value('id');
|
||||
|
||||
if ($userId) {
|
||||
DB::table('buku_tamu')->insert([
|
||||
[
|
||||
'id_user' => $userId,
|
||||
'tujuan_kunjungan' => 'Membaca Buku',
|
||||
'tanggal_kunjungan' => now(),
|
||||
],
|
||||
[
|
||||
'id_user' => $userId,
|
||||
'tujuan_kunjungan' => 'Meminjam Buku',
|
||||
'tanggal_kunjungan' => now()->subDay(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Buku;
|
||||
use App\Models\Anggota;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// Admin user
|
||||
User::create([
|
||||
'name' => 'Admin',
|
||||
'email' => 'admin@perpustakaan.com',
|
||||
'password' => Hash::make('password'),
|
||||
'role' => 'admin',
|
||||
]);
|
||||
|
||||
// Regular user
|
||||
User::create([
|
||||
'name' => 'User Test',
|
||||
'email' => 'user@perpustakaan.com',
|
||||
'password' => Hash::make('password'),
|
||||
'role' => 'user',
|
||||
]);
|
||||
|
||||
// Sample buku
|
||||
Buku::create([
|
||||
'judul' => 'Pemrograman Web dengan Laravel',
|
||||
'pengarang' => 'Adi Nugroho',
|
||||
'penerbit' => 'Informatika Bandung',
|
||||
'tahun_terbit' => 2023,
|
||||
'stok' => 5,
|
||||
]);
|
||||
|
||||
Buku::create([
|
||||
'judul' => 'Basis Data Lanjutan',
|
||||
'pengarang' => 'Fathansyah',
|
||||
'penerbit' => 'Informatika Bandung',
|
||||
'tahun_terbit' => 2020,
|
||||
'stok' => 3,
|
||||
]);
|
||||
|
||||
// Sample anggota
|
||||
Anggota::create([
|
||||
'nama' => 'Mahasiswa Test',
|
||||
'no_identitas' => 'E31230001',
|
||||
'jenis_anggota' => 'Mahasiswa',
|
||||
'no_ktp' => '3509012345678901',
|
||||
'prodi' => 'Manajemen Informatika',
|
||||
'no_hp' => '081234567890',
|
||||
'alamat' => 'Jl. Mastrip No. 164, Jember',
|
||||
'nama_wali' => 'Budi Santoso',
|
||||
'no_hp_wali' => '081298765432',
|
||||
'hubungan_wali' => 'Orang Tua',
|
||||
]);
|
||||
|
||||
$this->call([
|
||||
BukuTamuSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LokasiRakSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Mapping kode_rak → koordinat pusat (x%, y%) pada gambar denah.
|
||||
* Diambil dari array $shelves yang sudah ada di show.blade.php.
|
||||
*/
|
||||
private function getKoordinatRak(): array
|
||||
{
|
||||
return [
|
||||
'rak_000' => ['x' => 23.25, 'y' => 53], // Rak 01-05 Umum
|
||||
'rak_100' => ['x' => 30.25, 'y' => 53], // Rak 06-14 Filsafat
|
||||
'rak_200' => ['x' => 23.25, 'y' => 69], // Rak 15-32 Agama
|
||||
'rak_300' => ['x' => 30.25, 'y' => 69], // Rak 33-44 Sosial
|
||||
'rak_400' => ['x' => 43.5, 'y' => 50.25], // Rak 45 Bahasa
|
||||
'rak_500' => ['x' => 43.5, 'y' => 56.25], // Rak 46-48 Murni
|
||||
'rak_600' => ['x' => 43.5, 'y' => 62.25], // Rak 49-68 Terapan
|
||||
'rak_700' => ['x' => 43.5, 'y' => 68.75], // Rak 71-74 Seni
|
||||
'rak_800' => ['x' => 43.5, 'y' => 75.25], // Rak 77-79 Sastra
|
||||
'rak_900' => ['x' => 43.5, 'y' => 81.75], // Rak 69-84 Sejarah
|
||||
'rak_baru' => ['x' => 28.5, 'y' => 88.75], // Rak 75-76 Baru
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prediksi kode rak berdasarkan nomor panggil (duplikasi logika controller).
|
||||
*/
|
||||
private function getKodeRak(?string $nomor_panggil): string
|
||||
{
|
||||
if (empty($nomor_panggil)) {
|
||||
return 'none';
|
||||
}
|
||||
|
||||
$kode_utama = (int) substr(trim($nomor_panggil), 0, 3);
|
||||
|
||||
return match (true) {
|
||||
$kode_utama >= 0 && $kode_utama <= 99 => 'rak_000',
|
||||
$kode_utama >= 100 && $kode_utama <= 199 => 'rak_100',
|
||||
$kode_utama >= 200 && $kode_utama <= 299 => 'rak_200',
|
||||
$kode_utama >= 300 && $kode_utama <= 399 => 'rak_300',
|
||||
$kode_utama >= 400 && $kode_utama <= 499 => 'rak_400',
|
||||
$kode_utama >= 500 && $kode_utama <= 599 => 'rak_500',
|
||||
$kode_utama >= 600 && $kode_utama <= 699 => 'rak_600',
|
||||
$kode_utama >= 700 && $kode_utama <= 799 => 'rak_700',
|
||||
$kode_utama >= 800 && $kode_utama <= 899 => 'rak_800',
|
||||
$kode_utama >= 900 && $kode_utama <= 999 => 'rak_900',
|
||||
default => 'rak_baru',
|
||||
};
|
||||
}
|
||||
|
||||
public function run(): void
|
||||
{
|
||||
$koordinat = $this->getKoordinatRak();
|
||||
$bukus = DB::table('buku')->get();
|
||||
|
||||
foreach ($bukus as $buku) {
|
||||
$kodeRak = $this->getKodeRak($buku->nomor_panggil);
|
||||
|
||||
if ($kodeRak !== 'none' && isset($koordinat[$kodeRak])) {
|
||||
// Tambahkan sedikit random offset agar pin tidak menumpuk
|
||||
$offsetX = (rand(-15, 15) / 10);
|
||||
$offsetY = (rand(-10, 10) / 10);
|
||||
|
||||
DB::table('buku')
|
||||
->where('id_buku', $buku->id_buku)
|
||||
->update([
|
||||
'lokasi_x' => round($koordinat[$kodeRak]['x'] + $offsetX, 2),
|
||||
'lokasi_y' => round($koordinat[$kodeRak]['y'] + $offsetY, 2),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->command->info('Koordinat lokasi rak berhasil di-seed untuk ' . $bukus->count() . ' buku.');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,194 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines contain the default error messages used by
|
||||
| the validator class. Some of these rules have multiple versions such
|
||||
| as the size rules. Feel free to tweak each of these messages here.
|
||||
|
|
||||
*/
|
||||
|
||||
'accepted' => ':attribute wajib diterima.',
|
||||
'active_url' => ':attribute bukan URL yang valid.',
|
||||
'after' => ':attribute wajib tanggal setelah :date.',
|
||||
'after_or_equal' => ':attribute wajib tanggal setelah atau sama dengan :date.',
|
||||
'alpha' => ':attribute hanya boleh berisi huruf.',
|
||||
'alpha_dash' => ':attribute hanya boleh berisi huruf, angka, strip, dan garis bawah.',
|
||||
'alpha_num' => ':attribute hanya boleh berisi huruf dan angka.',
|
||||
'array' => ':attribute wajib berupa array.',
|
||||
'before' => ':attribute wajib tanggal sebelum :date.',
|
||||
'before_or_equal' => ':attribute wajib tanggal sebelum atau sama dengan :date.',
|
||||
'between' => [
|
||||
'numeric' => ':attribute wajib antara :min dan :max.',
|
||||
'file' => ':attribute wajib antara :min dan :max kilobita.',
|
||||
'string' => ':attribute wajib antara :min dan :max karakter.',
|
||||
'array' => ':attribute wajib memiliki antara :min dan :max item.',
|
||||
],
|
||||
'boolean' => ':attribute wajib bernilai true atau false.',
|
||||
'confirmed' => 'Konfirmasi :attribute tidak cocok.',
|
||||
'date' => ':attribute bukan tanggal yang valid.',
|
||||
'date_equals' => ':attribute wajib tanggal yang sama dengan :date.',
|
||||
'date_format' => ':attribute tidak cocok dengan format :format.',
|
||||
'different' => ':attribute dan :other wajib berbeda.',
|
||||
'digits' => ':attribute wajib :digits digit.',
|
||||
'digits_between' => ':attribute wajib antara :min dan :max digit.',
|
||||
'dimensions' => ':attribute memiliki dimensi gambar yang tidak valid.',
|
||||
'distinct' => ':attribute memiliki nilai duplikat.',
|
||||
'email' => ':attribute wajib berupa alamat email yang valid.',
|
||||
'ends_with' => ':attribute wajib diakhiri dengan salah satu dari berikut: :values.',
|
||||
'exists' => ':attribute yang dipilih tidak valid.',
|
||||
'file' => ':attribute wajib berupa file.',
|
||||
'filled' => ':attribute wajib memiliki nilai.',
|
||||
'gt' => [
|
||||
'numeric' => ':attribute wajib lebih besar dari :value.',
|
||||
'file' => ':attribute wajib lebih besar dari :value kilobita.',
|
||||
'string' => ':attribute wajib lebih besar dari :value karakter.',
|
||||
'array' => ':attribute wajib memiliki lebih dari :value item.',
|
||||
],
|
||||
'gte' => [
|
||||
'numeric' => ':attribute wajib lebih besar dari atau sama dengan :value.',
|
||||
'file' => ':attribute wajib lebih besar dari atau sama dengan :value kilobita.',
|
||||
'string' => ':attribute wajib lebih besar dari atau sama dengan :value karakter.',
|
||||
'array' => ':attribute wajib memiliki :value item atau lebih.',
|
||||
],
|
||||
'image' => ':attribute wajib berupa gambar.',
|
||||
'in' => ':attribute yang dipilih tidak valid.',
|
||||
'in_array' => ':attribute tidak ada di :other.',
|
||||
'integer' => ':attribute wajib berupa integer.',
|
||||
'ip' => ':attribute wajib berupa alamat IP yang valid.',
|
||||
'ipv4' => ':attribute wajib berupa alamat IPv4 yang valid.',
|
||||
'ipv6' => ':attribute wajib berupa alamat IPv6 yang valid.',
|
||||
'json' => ':attribute wajib berupa string JSON yang valid.',
|
||||
'lt' => [
|
||||
'numeric' => ':attribute wajib lebih kecil dari :value.',
|
||||
'file' => ':attribute wajib lebih kecil dari :value kilobita.',
|
||||
'string' => ':attribute wajib lebih kecil dari :value karakter.',
|
||||
'array' => ':attribute wajib memiliki kurang dari :value item.',
|
||||
],
|
||||
'lte' => [
|
||||
'numeric' => ':attribute wajib lebih kecil dari atau sama dengan :value.',
|
||||
'file' => ':attribute wajib lebih kecil dari atau sama dengan :value kilobita.',
|
||||
'string' => ':attribute wajib lebih kecil dari atau sama dengan :value karakter.',
|
||||
'array' => ':attribute wajib tidak boleh lebih dari :value item.',
|
||||
],
|
||||
'max' => [
|
||||
'numeric' => ':attribute tidak boleh lebih besar dari :max.',
|
||||
'file' => ':attribute tidak boleh lebih besar dari :max kilobita.',
|
||||
'string' => ':attribute tidak boleh lebih besar dari :max karakter.',
|
||||
'array' => ':attribute tidak boleh memiliki lebih dari :max item.',
|
||||
],
|
||||
'mimes' => ':attribute wajib berupa file bertipe: :values.',
|
||||
'mimetypes' => ':attribute wajib berupa file bertipe: :values.',
|
||||
'min' => [
|
||||
'numeric' => ':attribute wajib minimal :min.',
|
||||
'file' => ':attribute wajib minimal :min kilobita.',
|
||||
'string' => ':attribute wajib minimal :min karakter.',
|
||||
'array' => ':attribute wajib memiliki minimal :min item.',
|
||||
],
|
||||
'multiple_of' => ':attribute wajib kelipatan dari :value',
|
||||
'not_in' => ':attribute yang dipilih tidak valid.',
|
||||
'not_regex' => 'Format :attribute tidak valid.',
|
||||
'numeric' => ':attribute wajib berupa angka.',
|
||||
'password' => 'Password salah.',
|
||||
'present' => ':attribute wajib ada.',
|
||||
'regex' => 'Format :attribute tidak valid.',
|
||||
'required' => ':attribute wajib diisi.',
|
||||
'required_if' => ':attribute wajib diisi ketika :other adalah :value.',
|
||||
'required_unless' => ':attribute wajib diisi kecuali :other ada di :values.',
|
||||
'required_with' => ':attribute wajib diisi ketika :values ada.',
|
||||
'required_with_all' => ':attribute wajib diisi ketika :values ada.',
|
||||
'required_without' => ':attribute wajib diisi ketika :values tidak ada.',
|
||||
'required_without_all' => ':attribute wajib diisi ketika tidak ada satupun :values yang ada.',
|
||||
'prohibited' => ':attribute dilarang.',
|
||||
'prohibited_if' => ':attribute dilarang ketika :other adalah :value.',
|
||||
'prohibited_unless' => ':attribute dilarang kecuali :other ada di :values.',
|
||||
'same' => ':attribute dan :other wajib sama.',
|
||||
'size' => [
|
||||
'numeric' => ':attribute wajib berukuran :size.',
|
||||
'file' => ':attribute wajib berukuran :size kilobita.',
|
||||
'string' => ':attribute wajib berukuran :size karakter.',
|
||||
'array' => ':attribute wajib mengandung :size item.',
|
||||
],
|
||||
'starts_with' => ':attribute wajib diawali dengan salah satu dari berikut: :values.',
|
||||
'string' => ':attribute wajib berupa string.',
|
||||
'timezone' => ':attribute wajib berupa zona waktu yang valid.',
|
||||
'unique' => ':attribute sudah ada sebelumnya.',
|
||||
'uploaded' => ':attribute gagal diunggah.',
|
||||
'url' => 'Format :attribute tidak valid.',
|
||||
'uuid' => ':attribute wajib berupa UUID yang valid.',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify custom validation messages for attributes using the
|
||||
| convention "attribute.rule" to name the lines. This makes it quick to
|
||||
| specify a specific custom language line for a given attribute rule.
|
||||
|
|
||||
*/
|
||||
|
||||
'custom' => [
|
||||
'attribute-name' => [
|
||||
'rule-name' => 'custom-message',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Attributes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used to swap our attribute placeholder
|
||||
| with something more reader friendly such as "E-Mail Address" instead
|
||||
| of "email". This simply helps us make our message more expressive.
|
||||
|
|
||||
*/
|
||||
|
||||
'attributes' => [
|
||||
'name' => 'Nama',
|
||||
'username' => 'Username',
|
||||
'email' => 'Alamat Email',
|
||||
'first_name' => 'Nama Depan',
|
||||
'last_name' => 'Nama Belakang',
|
||||
'password' => 'Kata Sandi',
|
||||
'password_confirmation' => 'Konfirmasi Kata Sandi',
|
||||
'city' => 'Kota',
|
||||
'country' => 'Negara',
|
||||
'address' => 'Alamat',
|
||||
'phone' => 'Telepon',
|
||||
'mobile' => 'Seluler',
|
||||
'age' => 'Usia',
|
||||
'sex' => 'Jenis Kelamin',
|
||||
'gender' => 'Gender',
|
||||
'day' => 'Hari',
|
||||
'month' => 'Bulan',
|
||||
'year' => 'Tahun',
|
||||
'hour' => 'Jam',
|
||||
'minute' => 'Menit',
|
||||
'second' => 'Detik',
|
||||
'title' => 'Judul',
|
||||
'content' => 'Konten',
|
||||
'description' => 'Deskripsi',
|
||||
'excerpt' => 'Kutipan',
|
||||
'date' => 'Tanggal',
|
||||
'time' => 'Waktu',
|
||||
'available' => 'Tersedia',
|
||||
'size' => 'Ukuran',
|
||||
|
||||
// Atribut Khusus Guest Book
|
||||
'no_anggota' => 'Nomor Anggota',
|
||||
'keperluan' => 'Keperluan Kunjungan',
|
||||
'instansi' => 'Instansi / Asal Sekolah',
|
||||
'no_hp' => 'Nomor Handphone',
|
||||
'no_ktp' => 'Nomor KTP/Identitas',
|
||||
'status' => 'Status Keanggotaan',
|
||||
'alasan' => 'Alasan Pendaftaran',
|
||||
],
|
||||
|
||||
];
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"dev": "vite"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/forms": "^0.5.2",
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"alpinejs": "^3.4.2",
|
||||
"autoprefixer": "^10.4.2",
|
||||
"axios": "^1.11.0",
|
||||
"baseline-browser-mapping": "^2.9.19",
|
||||
"concurrently": "^9.0.1",
|
||||
"laravel-vite-plugin": "^2.0.0",
|
||||
"postcss": "^8.4.31",
|
||||
"tailwindcss": "^3.1.0",
|
||||
"vite": "^7.0.7"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory>tests/Unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Feature">
|
||||
<directory>tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<source>
|
||||
<include>
|
||||
<directory>app</directory>
|
||||
</include>
|
||||
</source>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="CACHE_STORE" value="array"/>
|
||||
<env name="DB_CONNECTION" value="sqlite"/>
|
||||
<env name="DB_DATABASE" value=":memory:"/>
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="PULSE_ENABLED" value="false"/>
|
||||
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||
<env name="NIGHTWATCH_ENABLED" value="false"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
export default {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Handle X-XSRF-Token Header
|
||||
RewriteCond %{HTTP:x-xsrf-token} .
|
||||
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Send Requests To Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 232 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.9 MiB |
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
// Determine if the application is in maintenance mode...
|
||||
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
|
||||
require $maintenance;
|
||||
}
|
||||
|
||||
// Register the Composer autoloader...
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
// Bootstrap Laravel and handle the request...
|
||||
/** @var Application $app */
|
||||
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
$app->handleRequest(Request::capture());
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
User-agent: *
|
||||
Disallow:
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import './bootstrap';
|
||||
|
||||
import Alpine from 'alpinejs';
|
||||
|
||||
window.Alpine = Alpine;
|
||||
|
||||
Alpine.start();
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
import axios from 'axios';
|
||||
window.axios = axios;
|
||||
|
||||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Pilih Login - SARAKATA</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
<script>
|
||||
tailwind.config = {
|
||||
theme: {
|
||||
extend: {
|
||||
fontFamily: { sans: ['Inter', 'sans-serif'] },
|
||||
colors: {
|
||||
primary: { 50:'#eef2ff',100:'#e0e7ff',200:'#c7d2fe',300:'#a5b4fc',400:'#818cf8',500:'#6366f1',600:'#4f46e5',700:'#4338ca',800:'#3730a3',900:'#312e81' },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.gradient-text { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #2563eb 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
|
||||
.card-option { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
|
||||
.card-option:hover { transform: translateY(-4px); }
|
||||
</style>
|
||||
</head>
|
||||
<body class="min-h-screen flex items-center justify-center font-sans antialiased bg-gradient-to-br from-gray-50 via-primary-50 to-gray-50 relative overflow-hidden">
|
||||
|
||||
{{-- Decorative --}}
|
||||
<div class="absolute top-20 -left-20 w-72 h-72 bg-primary-200/30 rounded-full blur-3xl"></div>
|
||||
<div class="absolute bottom-10 right-10 w-96 h-96 bg-purple-200/20 rounded-full blur-3xl"></div>
|
||||
|
||||
<div class="w-full max-w-md relative z-10 px-4">
|
||||
{{-- Logo --}}
|
||||
<div class="text-center mb-10">
|
||||
<div class="w-16 h-16 bg-gradient-to-br from-primary-500 to-primary-700 rounded-2xl flex items-center justify-center mx-auto shadow-2xl shadow-primary-200 mb-5">
|
||||
<i class="fas fa-book-open text-white text-2xl"></i>
|
||||
</div>
|
||||
<h1 class="text-3xl font-black text-gray-900 tracking-tight">Sara<span class="gradient-text">kata</span></h1>
|
||||
<p class="text-gray-400 text-sm mt-2">Sistem Informasi Perpustakaan</p>
|
||||
</div>
|
||||
|
||||
{{-- Options --}}
|
||||
<div class="space-y-4">
|
||||
<a href="{{ route('login.admin') }}" class="card-option block bg-white p-5 rounded-2xl border border-gray-100 shadow-sm hover:shadow-xl hover:shadow-primary-100/50 hover:border-primary-200 group">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="w-12 h-12 bg-gradient-to-br from-primary-500 to-primary-600 rounded-xl flex items-center justify-center shadow-lg shadow-primary-200 group-hover:shadow-primary-300 transition-shadow">
|
||||
<i class="fas fa-user-shield text-white"></i>
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<h3 class="font-bold text-gray-900 text-sm">Masuk Sebagai Admin</h3>
|
||||
<p class="text-gray-400 text-xs mt-0.5">Kelola perpustakaan sebagai administrator</p>
|
||||
</div>
|
||||
<i class="fas fa-chevron-right text-gray-300 group-hover:text-primary-500 transition-colors"></i>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="{{ route('buku_tamu.index') }}" class="card-option block bg-white p-5 rounded-2xl border border-gray-100 shadow-sm hover:shadow-xl hover:shadow-emerald-100/50 hover:border-emerald-200 group">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="w-12 h-12 bg-gradient-to-br from-emerald-500 to-emerald-600 rounded-xl flex items-center justify-center shadow-lg shadow-emerald-200 group-hover:shadow-emerald-300 transition-shadow">
|
||||
<i class="fas fa-pencil-alt text-white"></i>
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<h3 class="font-bold text-gray-900 text-sm">Isi Buku Tamu</h3>
|
||||
<p class="text-gray-400 text-xs mt-0.5">Catat kunjungan Anda ke perpustakaan</p>
|
||||
</div>
|
||||
<i class="fas fa-chevron-right text-gray-300 group-hover:text-emerald-500 transition-colors"></i>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="{{ route('home') }}" class="card-option block bg-white/50 p-5 rounded-2xl border border-gray-100 hover:bg-white group">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="w-12 h-12 bg-gray-100 rounded-xl flex items-center justify-center group-hover:bg-gray-200 transition-colors">
|
||||
<i class="fas fa-arrow-left text-gray-400"></i>
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<h3 class="font-bold text-gray-600 text-sm">Kembali ke Beranda</h3>
|
||||
<p class="text-gray-400 text-xs mt-0.5">Halaman utama perpustakaan</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p class="text-center text-gray-300 text-xs mt-10 font-medium">© {{ date('Y') }} Sarakata Library System</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<x-guest-layout>
|
||||
<div class="mb-4 text-sm text-gray-600">
|
||||
{{ __('This is a secure area of the application. Please confirm your password before continuing.') }}
|
||||
</div>
|
||||
|
||||
<form method="POST" action="{{ route('password.confirm') }}">
|
||||
@csrf
|
||||
|
||||
<!-- Password -->
|
||||
<div>
|
||||
<x-input-label for="password" :value="__('Password')" />
|
||||
|
||||
<x-text-input id="password" class="block mt-1 w-full"
|
||||
type="password"
|
||||
name="password"
|
||||
required autocomplete="current-password" />
|
||||
|
||||
<x-input-error :messages="$errors->get('password')" class="mt-2" />
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end mt-4">
|
||||
<x-primary-button>
|
||||
{{ __('Confirm') }}
|
||||
</x-primary-button>
|
||||
</div>
|
||||
</form>
|
||||
</x-guest-layout>
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Lupa Password - Perpustakaan Digital</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<style>
|
||||
body { font-family: 'Poppins', sans-serif; background-color: #f3f4f6; }
|
||||
@keyframes float-icon {
|
||||
0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.1; }
|
||||
50% { transform: translateY(-10px) rotate(5deg); opacity: 0.2; }
|
||||
}
|
||||
.bg-icon { animation: float-icon 5s ease-in-out infinite; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="min-h-screen flex items-center justify-center p-4">
|
||||
|
||||
<div class="w-full max-w-3xl bg-white rounded-2xl shadow-2xl overflow-hidden flex flex-col md:flex-row relative">
|
||||
|
||||
<div class="w-full md:w-1/2 p-8 flex flex-col justify-between relative z-10 order-2 md:order-1">
|
||||
<div class="flex items-center gap-2 mb-4">
|
||||
<div class="w-8 h-8 bg-blue-600 rounded flex items-center justify-center text-white font-bold text-sm">P</div>
|
||||
<span class="font-bold text-gray-800 text-lg">Perpustakaan</span>
|
||||
</div>
|
||||
|
||||
<div class="py-4">
|
||||
<h2 class="text-2xl font-bold text-gray-800 mb-2">Lupa Password?</h2>
|
||||
<p class="text-sm text-gray-500 leading-relaxed">
|
||||
Jangan khawatir. Cukup masukkan alamat email Anda dan kami akan mengirimkan tautan untuk mereset kata sandi Anda.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<a href="{{ route('login') }}" class="flex items-center text-xs text-gray-500 hover:text-blue-600 transition mt-4">
|
||||
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"/></svg>
|
||||
Kembali ke Login
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="w-full md:w-1/2 bg-gradient-to-br from-blue-700 to-blue-900 relative p-8 flex flex-col justify-center order-1 md:order-2">
|
||||
|
||||
<div class="absolute top-0 bottom-0 -left-1 hidden md:block w-12 h-full">
|
||||
<svg class="h-full w-full text-white fill-current" viewBox="0 0 100 100" preserveAspectRatio="none">
|
||||
<path d="M0 0 L0 100 Q 100 50 0 0 Z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<div class="absolute inset-0 overflow-hidden pointer-events-none">
|
||||
<svg class="bg-icon absolute top-8 right-8 w-16 h-16 text-white" fill="currentColor" viewBox="0 0 24 24"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3 3.1-3 1.71 0 3.1 1.29 3.1 3v2z"/></svg>
|
||||
</div>
|
||||
|
||||
<div class="relative z-10">
|
||||
<h3 class="text-xl font-bold text-white text-center mb-6">Reset Password</h3>
|
||||
|
||||
@if (session('status'))
|
||||
<div class="mb-4 bg-green-500/20 border border-green-500/50 text-white text-xs p-2.5 rounded-lg text-center backdrop-blur-sm">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="mb-4 bg-red-500/20 border border-red-500/50 text-white text-xs p-2.5 rounded-lg text-center backdrop-blur-sm">
|
||||
{{ $errors->first() }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ route('password.email') }}" class="space-y-4">
|
||||
@csrf
|
||||
|
||||
<div class="relative group">
|
||||
<input type="email" name="email" required placeholder="Masukkan Email Terdaftar"
|
||||
class="w-full px-4 py-3 text-sm bg-white/10 border border-white/20 rounded-lg text-white placeholder-blue-100/60 focus:outline-none focus:bg-white/20 focus:border-white transition backdrop-blur-sm shadow-sm">
|
||||
</div>
|
||||
|
||||
<button type="submit"
|
||||
class="w-full py-3 bg-emerald-500 hover:bg-emerald-400 text-white font-semibold rounded-lg shadow-lg transform active:scale-95 transition-all duration-200 text-sm tracking-wide mt-2">
|
||||
KIRIM LINK RESET
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
@extends('layouts.guest')
|
||||
|
||||
@section('title', 'Login Pengunjung')
|
||||
|
||||
@section('content')
|
||||
<div class="min-h-[70vh] flex items-center justify-center py-16">
|
||||
<div class="w-full max-w-md px-4">
|
||||
<div class="text-center mb-8">
|
||||
<div class="w-14 h-14 bg-gradient-to-br from-primary-500 to-primary-700 rounded-2xl flex items-center justify-center mx-auto shadow-xl shadow-primary-200 mb-4">
|
||||
<i class="fas fa-user text-white text-xl"></i>
|
||||
</div>
|
||||
<h2 class="text-2xl font-bold text-gray-900">Login Pengunjung</h2>
|
||||
<p class="text-gray-400 text-sm mt-2">Masuk dengan akun anggota Anda</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-3xl p-8 border border-gray-100 shadow-xl">
|
||||
@if ($errors->any())
|
||||
<div class="mb-6 bg-red-50 border border-red-100 text-red-600 text-xs p-4 rounded-xl">
|
||||
<ul class="list-disc pl-4 space-y-1">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form action="{{ route('login.user.process') }}" method="POST" class="space-y-5">
|
||||
@csrf
|
||||
|
||||
<div>
|
||||
<label class="block text-gray-600 text-xs font-semibold mb-2 uppercase tracking-wider">Email</label>
|
||||
<div class="relative">
|
||||
<div class="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none">
|
||||
<i class="fas fa-envelope text-gray-300 text-sm"></i>
|
||||
</div>
|
||||
<input type="email" name="email" value="{{ old('email') }}"
|
||||
class="w-full pl-11 pr-4 py-3.5 rounded-xl border border-gray-200 text-sm focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition"
|
||||
placeholder="email@example.com" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-gray-600 text-xs font-semibold mb-2 uppercase tracking-wider">Password</label>
|
||||
<div class="relative">
|
||||
<div class="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none">
|
||||
<i class="fas fa-lock text-gray-300 text-sm"></i>
|
||||
</div>
|
||||
<input type="password" name="password"
|
||||
class="w-full pl-11 pr-4 py-3.5 rounded-xl border border-gray-200 text-sm focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition"
|
||||
placeholder="••••••••" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit"
|
||||
class="w-full py-3.5 bg-gradient-to-r from-primary-500 to-primary-600 hover:from-primary-600 hover:to-primary-700 text-white font-bold rounded-xl transition-all shadow-lg shadow-primary-200 active:scale-[0.98] text-sm">
|
||||
<i class="fas fa-sign-in-alt mr-2"></i> Login
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div class="text-center mt-6 text-sm">
|
||||
<span class="text-gray-400">Belum punya akun?</span>
|
||||
<a href="{{ route('register') }}" class="text-primary-600 font-semibold hover:text-primary-700 ml-1">Daftar Sekarang</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Admin Login - SARAKATA</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
<script>
|
||||
tailwind.config = {
|
||||
theme: {
|
||||
extend: {
|
||||
fontFamily: { sans: ['Inter', 'sans-serif'] },
|
||||
colors: {
|
||||
primary: { 50:'#eef2ff',100:'#e0e7ff',200:'#c7d2fe',300:'#a5b4fc',400:'#818cf8',500:'#6366f1',600:'#4f46e5',700:'#4338ca',800:'#3730a3',900:'#312e81' },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.gradient-text { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #2563eb 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
|
||||
.glass-input { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: white; transition: all 0.3s; }
|
||||
.glass-input:focus { background: rgba(255,255,255,0.12); border-color: rgba(129,140,248,0.6); box-shadow: 0 0 20px rgba(99,102,241,0.15); outline: none; }
|
||||
.glass-input::placeholder { color: rgba(165,180,252,0.5); }
|
||||
</style>
|
||||
</head>
|
||||
<body class="min-h-screen flex items-center justify-center font-sans antialiased bg-gradient-to-br from-primary-900 via-gray-900 to-gray-900 relative overflow-hidden">
|
||||
|
||||
{{-- Decorative blobs --}}
|
||||
<div class="absolute top-20 -left-20 w-96 h-96 bg-primary-600/20 rounded-full blur-3xl"></div>
|
||||
<div class="absolute bottom-20 right-10 w-80 h-80 bg-purple-600/15 rounded-full blur-3xl"></div>
|
||||
<div class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px] bg-primary-500/5 rounded-full blur-3xl"></div>
|
||||
|
||||
<div class="w-full max-w-md relative z-10 px-4">
|
||||
{{-- Logo --}}
|
||||
<div class="text-center mb-10">
|
||||
<div class="w-16 h-16 bg-gradient-to-br from-primary-500 to-primary-700 rounded-2xl flex items-center justify-center mx-auto shadow-2xl shadow-primary-500/30 mb-5">
|
||||
<i class="fas fa-book-open text-white text-2xl"></i>
|
||||
</div>
|
||||
<h2 class="text-white text-3xl font-black tracking-tight">Sara<span class="gradient-text">kata</span></h2>
|
||||
<p class="text-primary-300/60 text-sm mt-2 font-medium">Sistem Informasi Perpustakaan</p>
|
||||
</div>
|
||||
|
||||
{{-- Login Card --}}
|
||||
<div class="bg-white/[0.07] backdrop-blur-xl rounded-3xl p-8 border border-white/10 shadow-2xl">
|
||||
<div class="mb-8">
|
||||
<h3 class="text-white text-xl font-bold">Masuk ke Dashboard</h3>
|
||||
<p class="text-primary-300/50 text-sm mt-1">Masukkan kredensial admin Anda.</p>
|
||||
</div>
|
||||
|
||||
<form action="{{ route('login.admin.process') }}" method="POST" class="space-y-5">
|
||||
@csrf
|
||||
|
||||
<div>
|
||||
<label class="block text-primary-200/70 text-xs font-semibold mb-2 uppercase tracking-wider">Email</label>
|
||||
<div class="relative">
|
||||
<div class="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none">
|
||||
<i class="fas fa-envelope text-primary-400/40 text-sm"></i>
|
||||
</div>
|
||||
<input type="email" name="email" value="{{ old('email') }}"
|
||||
class="w-full pl-11 pr-4 py-3.5 rounded-xl glass-input text-sm"
|
||||
placeholder="admin@example.com" required>
|
||||
</div>
|
||||
@error('email') <span class="text-red-400 text-xs mt-1.5 block"><i class="fas fa-exclamation-circle mr-1"></i>{{ $message }}</span> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-primary-200/70 text-xs font-semibold mb-2 uppercase tracking-wider">Password</label>
|
||||
<div class="relative">
|
||||
<div class="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none">
|
||||
<i class="fas fa-lock text-primary-400/40 text-sm"></i>
|
||||
</div>
|
||||
<input type="password" name="password"
|
||||
class="w-full pl-11 pr-4 py-3.5 rounded-xl glass-input text-sm"
|
||||
placeholder="••••••••" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between pt-1">
|
||||
<label class="flex items-center text-xs text-primary-200/50 cursor-pointer gap-2">
|
||||
<input type="checkbox" name="remember" class="rounded border-primary-400/30 bg-transparent text-primary-500 focus:ring-primary-500"> Remember me
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<button type="submit"
|
||||
class="w-full py-3.5 bg-gradient-to-r from-primary-500 to-primary-600 hover:from-primary-600 hover:to-primary-700 text-white font-bold rounded-xl transition-all shadow-xl shadow-primary-500/25 active:scale-[0.98] text-sm tracking-wide">
|
||||
<i class="fas fa-sign-in-alt mr-2"></i> Masuk
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="text-center text-primary-400/30 text-xs mt-8 font-medium">© {{ date('Y') }} Sarakata Library System</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,198 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Daftar Anggota - Sarakata</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
<script>
|
||||
tailwind.config = {
|
||||
theme: { extend: {
|
||||
fontFamily: { sans: ['Inter', 'sans-serif'] },
|
||||
colors: { primary: { 50:'#eef2ff',100:'#e0e7ff',200:'#c7d2fe',300:'#a5b4fc',400:'#818cf8',500:'#6366f1',600:'#4f46e5',700:'#4338ca',800:'#3730a3',900:'#312e81' } }
|
||||
}}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.gradient-text { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #2563eb 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
|
||||
.glass-input { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: white; transition: all 0.3s; }
|
||||
.glass-input:focus { background: rgba(255,255,255,0.12); border-color: rgba(129,140,248,0.6); box-shadow: 0 0 20px rgba(99,102,241,0.15); outline: none; }
|
||||
.glass-input::placeholder { color: rgba(165,180,252,0.4); }
|
||||
select.glass-input option { background-color: #312e81; color: white; }
|
||||
.no-scrollbar::-webkit-scrollbar { width: 4px; }
|
||||
.no-scrollbar::-webkit-scrollbar-track { background: transparent; }
|
||||
.no-scrollbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="min-h-screen flex items-center justify-center p-4 bg-gray-50 font-sans antialiased">
|
||||
|
||||
<div class="w-full max-w-6xl bg-white rounded-3xl shadow-2xl overflow-hidden flex flex-col md:flex-row h-auto md:h-[88vh]">
|
||||
|
||||
{{-- LEFT PANEL --}}
|
||||
<div class="w-full md:w-5/12 p-10 md:p-12 flex flex-col justify-between relative overflow-hidden">
|
||||
<div class="absolute -top-10 -left-10 w-40 h-40 bg-primary-100 rounded-full blur-3xl opacity-50"></div>
|
||||
<div class="absolute bottom-10 right-10 w-60 h-60 bg-primary-50 rounded-full blur-3xl opacity-50"></div>
|
||||
|
||||
<div class="relative z-10">
|
||||
<div class="flex items-center gap-3 mb-10">
|
||||
<div class="w-10 h-10 bg-gradient-to-br from-primary-500 to-primary-700 rounded-xl flex items-center justify-center shadow-lg shadow-primary-200">
|
||||
<i class="fas fa-book-open text-white text-sm"></i>
|
||||
</div>
|
||||
<span class="font-extrabold text-xl text-gray-900 tracking-tight">Sara<span class="gradient-text">kata</span></span>
|
||||
</div>
|
||||
|
||||
<h1 class="text-3xl md:text-4xl font-black text-gray-900 mb-4 leading-tight">
|
||||
Mulai Perjalanan<br>Literasi Anda.
|
||||
</h1>
|
||||
<p class="text-gray-400 leading-relaxed text-sm">
|
||||
Daftarkan diri Anda sekarang untuk mengakses ribuan koleksi buku digital, jurnal, dan fasilitas perpustakaan.
|
||||
</p>
|
||||
|
||||
<div class="mt-8 space-y-3">
|
||||
<div class="flex items-center gap-3 text-sm text-gray-500">
|
||||
<span class="w-6 h-6 rounded-full bg-primary-100 text-primary-600 flex items-center justify-center text-xs"><i class="fas fa-check"></i></span>
|
||||
Akses Peminjaman Buku
|
||||
</div>
|
||||
<div class="flex items-center gap-3 text-sm text-gray-500">
|
||||
<span class="w-6 h-6 rounded-full bg-primary-100 text-primary-600 flex items-center justify-center text-xs"><i class="fas fa-check"></i></span>
|
||||
Riwayat Kunjungan Digital
|
||||
</div>
|
||||
<div class="flex items-center gap-3 text-sm text-gray-500">
|
||||
<span class="w-6 h-6 rounded-full bg-primary-100 text-primary-600 flex items-center justify-center text-xs"><i class="fas fa-check"></i></span>
|
||||
Gratis untuk Sivitas Akademika
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="relative z-10 mt-6 md:mt-0">
|
||||
<p class="text-xs text-gray-300 font-medium">© {{ date('Y') }} Sarakata Library System</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- RIGHT PANEL (Form) --}}
|
||||
<div class="w-full md:w-7/12 bg-gradient-to-br from-primary-900 via-primary-800 to-primary-900 relative flex flex-col p-8 md:p-12">
|
||||
|
||||
<div class="flex justify-between items-center mb-6 border-b border-white/10 pb-4">
|
||||
<div>
|
||||
<h2 class="text-2xl font-bold text-white">Formulir Pendaftaran</h2>
|
||||
<p class="text-primary-300/60 text-xs mt-1">Isi data diri dengan lengkap dan benar.</p>
|
||||
</div>
|
||||
<div class="hidden md:block text-white/10">
|
||||
<i class="fas fa-file-alt text-3xl"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 overflow-y-auto no-scrollbar pr-2">
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="mb-6 bg-red-500/20 border border-red-500/30 text-white text-xs p-4 rounded-xl">
|
||||
<ul class="list-disc pl-4 space-y-1">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ route('register') }}" class="space-y-5">
|
||||
@csrf
|
||||
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-primary-200/70 mb-1.5 ml-1 uppercase tracking-wider">Nama Lengkap</label>
|
||||
<input type="text" name="name" required placeholder="Masukkan nama sesuai KTP" value="{{ old('name') }}"
|
||||
class="w-full px-5 py-3.5 rounded-xl glass-input text-sm">
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-primary-200/70 mb-1.5 ml-1 uppercase tracking-wider">Email</label>
|
||||
<input type="email" name="email" required placeholder="nama@email.com" value="{{ old('email') }}"
|
||||
class="w-full px-5 py-3.5 rounded-xl glass-input text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-primary-200/70 mb-1.5 ml-1 uppercase tracking-wider">No. WhatsApp</label>
|
||||
<input type="text" name="no_hp" required placeholder="08xxxxxxxxxx" value="{{ old('no_hp') }}"
|
||||
class="w-full px-5 py-3.5 rounded-xl glass-input text-sm">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-primary-200/70 mb-1.5 ml-1 uppercase tracking-wider">Asal Instansi</label>
|
||||
<input type="text" name="instansi" required placeholder="Contoh: Politeknik Negeri Jember" value="{{ old('instansi') }}"
|
||||
class="w-full px-5 py-3.5 rounded-xl glass-input text-sm">
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-primary-200/70 mb-1.5 ml-1 uppercase tracking-wider">Status</label>
|
||||
<div class="relative">
|
||||
<select name="status" required class="w-full px-5 py-3.5 rounded-xl glass-input text-sm appearance-none cursor-pointer">
|
||||
<option value="" disabled selected>Pilih Status</option>
|
||||
<option value="Mahasiswa">Mahasiswa</option>
|
||||
<option value="Siswa">Siswa</option>
|
||||
<option value="Dosen">Dosen/Guru</option>
|
||||
<option value="Umum">Umum</option>
|
||||
</select>
|
||||
<div class="absolute inset-y-0 right-0 flex items-center px-4 pointer-events-none text-primary-300/40">
|
||||
<i class="fas fa-chevron-down text-xs"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-primary-200/70 mb-1.5 ml-1 uppercase tracking-wider">No. Identitas (NIK/NISN)</label>
|
||||
<input type="text" name="no_ktp" required placeholder="16 digit angka" value="{{ old('no_ktp') }}"
|
||||
class="w-full px-5 py-3.5 rounded-xl glass-input text-sm">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-primary-200/70 mb-1.5 ml-1 uppercase tracking-wider">Tujuan Pendaftaran</label>
|
||||
<div class="relative">
|
||||
<select name="alasan" required class="w-full px-5 py-3.5 rounded-xl glass-input text-sm appearance-none cursor-pointer">
|
||||
<option value="Membaca & Meminjam">Membaca & Meminjam Buku</option>
|
||||
<option value="Penelitian">Penelitian / Tugas Akhir</option>
|
||||
<option value="Berkunjung">Sekedar Berkunjung</option>
|
||||
</select>
|
||||
<div class="absolute inset-y-0 right-0 flex items-center px-4 pointer-events-none text-primary-300/40">
|
||||
<i class="fas fa-chevron-down text-xs"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="border-t border-white/10 my-2"></div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-primary-200/70 mb-1.5 ml-1 uppercase tracking-wider">Password</label>
|
||||
<input type="password" name="password" required placeholder="Min. 8 karakter"
|
||||
class="w-full px-5 py-3.5 rounded-xl glass-input text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-primary-200/70 mb-1.5 ml-1 uppercase tracking-wider">Konfirmasi Password</label>
|
||||
<input type="password" name="password_confirmation" required placeholder="Ketik ulang"
|
||||
class="w-full px-5 py-3.5 rounded-xl glass-input text-sm">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pt-2">
|
||||
<button type="submit"
|
||||
class="w-full py-3.5 bg-gradient-to-r from-primary-400 to-primary-500 hover:from-primary-500 hover:to-primary-600 text-white font-bold rounded-xl shadow-xl shadow-primary-500/20 active:scale-[0.98] transition-all text-sm tracking-wide">
|
||||
<i class="fas fa-user-plus mr-2"></i> Daftar Sekarang
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="text-center mt-6 mb-2">
|
||||
<p class="text-xs text-primary-200/50">
|
||||
Sudah memiliki akun anggota?
|
||||
<a href="{{ route('login') }}" class="text-white font-semibold hover:text-primary-300 transition underline decoration-primary-400/40 underline-offset-4">Masuk disini</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<x-guest-layout>
|
||||
<form method="POST" action="{{ route('password.store') }}">
|
||||
@csrf
|
||||
|
||||
<!-- Password Reset Token -->
|
||||
<input type="hidden" name="token" value="{{ $request->route('token') }}">
|
||||
|
||||
<!-- Email Address -->
|
||||
<div>
|
||||
<x-input-label for="email" :value="__('Email')" />
|
||||
<x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email', $request->email)" required autofocus autocomplete="username" />
|
||||
<x-input-error :messages="$errors->get('email')" class="mt-2" />
|
||||
</div>
|
||||
|
||||
<!-- Password -->
|
||||
<div class="mt-4">
|
||||
<x-input-label for="password" :value="__('Password')" />
|
||||
<x-text-input id="password" class="block mt-1 w-full" type="password" name="password" required autocomplete="new-password" />
|
||||
<x-input-error :messages="$errors->get('password')" class="mt-2" />
|
||||
</div>
|
||||
|
||||
<!-- Confirm Password -->
|
||||
<div class="mt-4">
|
||||
<x-input-label for="password_confirmation" :value="__('Confirm Password')" />
|
||||
|
||||
<x-text-input id="password_confirmation" class="block mt-1 w-full"
|
||||
type="password"
|
||||
name="password_confirmation" required autocomplete="new-password" />
|
||||
|
||||
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end mt-4">
|
||||
<x-primary-button>
|
||||
{{ __('Reset Password') }}
|
||||
</x-primary-button>
|
||||
</div>
|
||||
</form>
|
||||
</x-guest-layout>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<x-guest-layout>
|
||||
<div class="mb-4 text-sm text-gray-600">
|
||||
{{ __('Thanks for signing up! Before getting started, could you verify your email address by clicking on the link we just emailed to you? If you didn\'t receive the email, we will gladly send you another.') }}
|
||||
</div>
|
||||
|
||||
@if (session('status') == 'verification-link-sent')
|
||||
<div class="mb-4 font-medium text-sm text-green-600">
|
||||
{{ __('A new verification link has been sent to the email address you provided during registration.') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="mt-4 flex items-center justify-between">
|
||||
<form method="POST" action="{{ route('verification.send') }}">
|
||||
@csrf
|
||||
|
||||
<div>
|
||||
<x-primary-button>
|
||||
{{ __('Resend Verification Email') }}
|
||||
</x-primary-button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form method="POST" action="{{ route('logout') }}">
|
||||
@csrf
|
||||
|
||||
<button type="submit" class="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
|
||||
{{ __('Log Out') }}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</x-guest-layout>
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
@extends('layouts.admin')
|
||||
|
||||
@section('title', 'Manajemen Admin')
|
||||
|
||||
@section('content')
|
||||
<div x-data="{ isModalOpen: false }" x-cloak>
|
||||
<x-page-header title="Manajemen Akun Admin">
|
||||
<x-slot name="actions">
|
||||
<button @click="isModalOpen = true" class="bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white px-5 py-2.5 rounded-lg border border-transparent shadow-[0_4px_10px_rgba(37,99,235,0.2)] hover:shadow-[0_6px_15px_rgba(37,99,235,0.3)] transition-all font-semibold flex items-center gap-2 transform hover:translate-y-[-1px]">
|
||||
<i class="fas fa-plus mr-1"></i> Tambah Admin
|
||||
</button>
|
||||
</x-slot>
|
||||
</x-page-header>
|
||||
|
||||
<x-alert type="success" :message="session('success')" />
|
||||
<x-alert type="error" :message="session('error')" />
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="bg-red-50 border-l-4 border-red-500 text-red-700 p-4 mb-6 rounded-r-xl text-sm shadow-sm">
|
||||
<p class="font-bold mb-1"><i class="fas fa-exclamation-circle mr-1"></i> Validasi Gagal</p>
|
||||
<ul class="list-disc ml-5 space-y-1">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<x-card>
|
||||
<x-table>
|
||||
<x-slot name="head">
|
||||
<x-th>Nama Admin</x-th>
|
||||
<x-th>Email</x-th>
|
||||
<x-th>Tanggal Terdaftar</x-th>
|
||||
<x-th class="text-right">Aksi</x-th>
|
||||
</x-slot>
|
||||
|
||||
@foreach($admins as $admin)
|
||||
<tr class="hover:bg-gray-50 transition-colors">
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="flex items-center">
|
||||
<div class="w-8 h-8 rounded-full overflow-hidden border border-gray-200 mr-3">
|
||||
<img src="https://ui-avatars.com/api/?name={{ urlencode($admin->name) }}&background=6366f1&color=fff" class="w-full h-full object-cover">
|
||||
</div>
|
||||
<div class="text-sm font-bold text-gray-900">{{ $admin->name }}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||
{{ $admin->email }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||
{{ $admin->created_at->format('d M Y') }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
@if(auth()->id() !== $admin->id)
|
||||
<form action="{{ route('admin.akun.destroy', $admin->id) }}" method="POST" class="inline-block" onsubmit="return confirm('Apakah Anda yakin ingin menghapus akun admin ini?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="bg-red-100 text-red-700 hover:bg-red-200 px-3 py-1.5 rounded text-xs font-bold transition flex items-center">
|
||||
<i class="fas fa-trash-alt mr-1"></i> Hapus
|
||||
</button>
|
||||
</form>
|
||||
@else
|
||||
<span class="text-xs font-bold text-gray-400 bg-gray-100 px-3 py-1.5 rounded">Akun Anda</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</x-table>
|
||||
</x-card>
|
||||
|
||||
<!-- Modal Tambah Admin -->
|
||||
<div x-show="isModalOpen" style="display: none;" class="fixed inset-0 z-50 overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true">
|
||||
<div class="flex items-end justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0">
|
||||
<div x-show="isModalOpen" x-transition.opacity class="fixed inset-0 transition-opacity bg-gray-900/60 backdrop-blur-sm" aria-hidden="true" @click="isModalOpen = false"></div>
|
||||
|
||||
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
|
||||
|
||||
<div x-show="isModalOpen"
|
||||
x-transition:enter="ease-out duration-300 transform"
|
||||
x-transition:enter-start="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
||||
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave="ease-in duration-200 transform"
|
||||
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave-end="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
||||
class="relative z-[60] inline-block px-4 pt-5 pb-4 overflow-hidden text-left align-bottom transition-all bg-white rounded-3xl shadow-2xl sm:my-8 sm:align-middle sm:max-w-xl sm:w-full sm:p-8 border border-gray-100">
|
||||
|
||||
<div class="flex justify-between items-center mb-6 pl-2">
|
||||
<div>
|
||||
<h3 class="text-2xl font-bold text-gray-900" id="modal-title">Pendaftaran Admin Baru</h3>
|
||||
<p class="text-sm text-gray-500 mt-1">Buat akun untuk pengelola perpustakaan yang baru.</p>
|
||||
</div>
|
||||
<button @click="isModalOpen = false" class="w-10 h-10 rounded-full bg-gray-50 hover:bg-red-50 text-gray-400 hover:text-red-500 flex items-center justify-center transition-colors">
|
||||
<i class="fas fa-times text-lg"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="{{ route('admin.akun.store') }}" method="POST" class="space-y-5">
|
||||
@csrf
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Nama Lengkap</label>
|
||||
<input type="text" name="name" value="{{ old('name') }}" placeholder="Masukkan nama..." class="w-full rounded-xl border-gray-300 focus:border-blue-500 focus:ring-blue-500 shadow-sm bg-gray-50/50" required>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Email</label>
|
||||
<input type="email" name="email" value="{{ old('email') }}" placeholder="admin@domain.com" class="w-full rounded-xl border-gray-300 focus:border-blue-500 focus:ring-blue-500 shadow-sm bg-gray-50/50" required>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Password</label>
|
||||
<input type="password" name="password" placeholder="Minimal 8 karakter" class="w-full rounded-xl border-gray-300 focus:border-blue-500 focus:ring-blue-500 shadow-sm bg-gray-50/50" required>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Konfirmasi Password</label>
|
||||
<input type="password" name="password_confirmation" placeholder="Ulangi password" class="w-full rounded-xl border-gray-300 focus:border-blue-500 focus:ring-blue-500 shadow-sm bg-gray-50/50" required>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 pt-4 border-t border-gray-100 mt-6">
|
||||
<button type="button" @click="isModalOpen = false" class="px-5 py-2.5 text-gray-600 bg-gray-100 hover:bg-gray-200 hover:text-gray-900 rounded-xl font-semibold transition-colors">
|
||||
Batal
|
||||
</button>
|
||||
<button type="submit" class="bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white px-6 py-2.5 rounded-xl font-bold shadow-lg shadow-blue-500/30 transition-all transform hover:scale-105 flex items-center gap-2">
|
||||
<i class="fas fa-check-circle"></i> Daftarkan Admin
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
@extends('layouts.admin')
|
||||
|
||||
@section('title', 'Tambah Koleksi Buku')
|
||||
|
||||
@section('content')
|
||||
<x-page-header title="Tambah Koleksi Buku" />
|
||||
|
||||
<x-card class="max-w-4xl mx-auto">
|
||||
|
||||
@if(session('success'))
|
||||
<div class="bg-green-100 border-l-4 border-green-500 text-green-700 p-4 m-6 mb-0" role="alert">
|
||||
<p class="font-bold">Berhasil</p>
|
||||
<p>{{ session('success') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4 m-6 mb-0" role="alert">
|
||||
<p class="font-bold">Validasi Gagal</p>
|
||||
<ul class="list-disc ml-5">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form action="{{ route('admin.buku.store') }}" method="POST" enctype="multipart/form-data" class="p-6 space-y-6">
|
||||
@csrf
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<x-input-label for="bibid" value="BIBID" />
|
||||
<x-text-input id="bibid" name="bibid" type="text" class="mt-1 block w-full" :value="old('bibid')" />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="id_kategori" value="Kategori" />
|
||||
<select id="id_kategori" name="id_kategori" class="mt-1 block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm">
|
||||
<option value="">Pilih Kategori</option>
|
||||
@foreach($kategori as $kat)
|
||||
<option value="{{ $kat->id_kategori }}" {{ old('id_kategori') == $kat->id_kategori ? 'selected' : '' }}>
|
||||
{{ $kat->nama_kategori }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="judul" value="Judul Buku" />
|
||||
<x-text-input id="judul" name="judul" type="text" class="mt-1 block w-full" :value="old('judul')" />
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<x-input-label for="pengarang" value="Pengarang" />
|
||||
<x-text-input id="pengarang" name="pengarang" type="text" class="mt-1 block w-full" :value="old('pengarang')" />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="nomor_panggil" value="Nomor Panggil (DDC)" />
|
||||
<x-text-input id="nomor_panggil" name="nomor_panggil" type="text" class="mt-1 block w-full" :value="old('nomor_panggil')" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
<div>
|
||||
<x-input-label for="penerbit" value="Penerbit" />
|
||||
<x-text-input id="penerbit" name="penerbit" type="text" class="mt-1 block w-full" :value="old('penerbit')" />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="tahun_terbit" value="Tahun Terbit" />
|
||||
<x-text-input id="tahun_terbit" name="tahun_terbit" type="number" class="mt-1 block w-full" :value="old('tahun_terbit')" />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="edisi" value="Edisi" />
|
||||
<x-text-input id="edisi" name="edisi" type="text" class="mt-1 block w-full" :value="old('edisi')" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<x-input-label for="deskripsi_fisik" value="Deskripsi Fisik" />
|
||||
<x-text-input id="deskripsi_fisik" name="deskripsi_fisik" type="text" class="mt-1 block w-full" :value="old('deskripsi_fisik')" />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="eksemplar" value="Jumlah Eksemplar" />
|
||||
<x-text-input id="eksemplar" name="eksemplar" type="number" class="mt-1 block w-full" :value="old('eksemplar')" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="border-t border-gray-100 pt-6">
|
||||
<x-input-label for="cover" value="Unggah Gambar Cover (Opsional)" />
|
||||
<input type="file" id="cover" name="cover" accept="image/*" class="mt-1 block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-indigo-50 file:text-indigo-700 hover:file:bg-indigo-100">
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-4 pt-4 border-t border-gray-200">
|
||||
<a href="{{ route('admin.buku.index') }}" class="text-gray-600 hover:text-gray-900 font-medium text-sm">Batal</a>
|
||||
<x-primary-button>
|
||||
Simpan Buku
|
||||
</x-primary-button>
|
||||
</div>
|
||||
</form>
|
||||
</x-card>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
@extends('layouts.admin')
|
||||
|
||||
@section('title', 'Revisi Koleksi Buku')
|
||||
|
||||
@section('content')
|
||||
<x-page-header title="Revisi Koleksi Buku" />
|
||||
|
||||
<x-card class="max-w-4xl mx-auto">
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4 m-6 mb-0" role="alert">
|
||||
<p class="font-bold">Validasi Gagal</p>
|
||||
<ul class="list-disc ml-5">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form action="{{ route('admin.buku.update', $buku->id_buku) }}" method="POST" enctype="multipart/form-data" class="p-6 space-y-6">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<x-input-label for="bibid" value="BIBID" />
|
||||
<x-text-input id="bibid" name="bibid" type="text" class="mt-1 block w-full" :value="old('bibid', $buku->bibid)" />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="id_kategori" value="Kategori" />
|
||||
<select id="id_kategori" name="id_kategori" class="mt-1 block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm">
|
||||
<option value="">Pilih Kategori</option>
|
||||
@foreach($kategori as $kat)
|
||||
<option value="{{ $kat->id_kategori }}" {{ old('id_kategori', $buku->id_kategori) == $kat->id_kategori ? 'selected' : '' }}>
|
||||
{{ $kat->nama_kategori }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="judul" value="Judul Buku" />
|
||||
<x-text-input id="judul" name="judul" type="text" class="mt-1 block w-full" :value="old('judul', $buku->judul)" />
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<x-input-label for="pengarang" value="Pengarang" />
|
||||
<x-text-input id="pengarang" name="pengarang" type="text" class="mt-1 block w-full" :value="old('pengarang', $buku->pengarang)" />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="nomor_panggil" value="Nomor Panggil (DDC)" />
|
||||
<x-text-input id="nomor_panggil" name="nomor_panggil" type="text" class="mt-1 block w-full" :value="old('nomor_panggil', $buku->nomor_panggil)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
<div>
|
||||
<x-input-label for="penerbit" value="Penerbit" />
|
||||
<x-text-input id="penerbit" name="penerbit" type="text" class="mt-1 block w-full" :value="old('penerbit', $buku->penerbit)" />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="tahun_terbit" value="Tahun Terbit" />
|
||||
<x-text-input id="tahun_terbit" name="tahun_terbit" type="number" class="mt-1 block w-full" :value="old('tahun_terbit', $buku->tahun_terbit)" />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="edisi" value="Edisi" />
|
||||
<x-text-input id="edisi" name="edisi" type="text" class="mt-1 block w-full" :value="old('edisi', $buku->edisi)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<x-input-label for="deskripsi_fisik" value="Deskripsi Fisik" />
|
||||
<x-text-input id="deskripsi_fisik" name="deskripsi_fisik" type="text" class="mt-1 block w-full" :value="old('deskripsi_fisik', $buku->deskripsi_fisik)" />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="eksemplar" value="Jumlah Eksemplar" />
|
||||
<x-text-input id="eksemplar" name="eksemplar" type="number" class="mt-1 block w-full" :value="old('eksemplar', $buku->eksemplar)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="border-t border-gray-100 pt-6">
|
||||
<x-input-label for="cover" value="Unggah Gambar Cover (Opsional)" />
|
||||
<input type="file" id="cover" name="cover" accept="image/*" class="mt-1 block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-indigo-50 file:text-indigo-700 hover:file:bg-indigo-100">
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-4 pt-4 border-t border-gray-200">
|
||||
<a href="{{ route('admin.buku.index') }}" class="text-gray-600 hover:text-gray-900 font-medium text-sm">Batal</a>
|
||||
<x-primary-button>
|
||||
Simpan Perubahan
|
||||
</x-primary-button>
|
||||
</div>
|
||||
</form>
|
||||
</x-card>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
@extends('layouts.admin')
|
||||
|
||||
@section('title', 'Katalog Buku')
|
||||
|
||||
@section('content')
|
||||
<div x-data="{ isModalBukuOpen: {{ ($errors->any() || request('add') == 'true') ? 'true' : 'false' }} }">
|
||||
<x-page-header title="Portofolio Katalog Buku">
|
||||
<x-slot name="actions">
|
||||
<button @click="isModalBukuOpen = true" class="bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white px-5 py-2.5 rounded-xl shadow-lg shadow-blue-500/30 transition-all font-semibold flex items-center gap-2 transform hover:scale-105">
|
||||
<i class="fas fa-plus"></i> Tambah Buku Baru
|
||||
</button>
|
||||
</x-slot>
|
||||
</x-page-header>
|
||||
|
||||
<x-alert type="success" :message="session('success')" />
|
||||
|
||||
<div class="mb-6">
|
||||
<form method="GET" action="{{ route('admin.buku.index') }}" class="flex gap-2">
|
||||
<x-text-input
|
||||
type="text"
|
||||
name="search"
|
||||
value="{{ request('search') }}"
|
||||
placeholder="Cari berdasarkan Judul atau BIBID..."
|
||||
class="w-full md:w-80"
|
||||
/>
|
||||
<x-primary-button>
|
||||
Cari
|
||||
</x-primary-button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<x-card>
|
||||
<x-table>
|
||||
<x-slot name="head">
|
||||
<x-th>BIBID</x-th>
|
||||
<x-th>Judul & Pengarang</x-th>
|
||||
<x-th>Kategori</x-th>
|
||||
<x-th>Stok</x-th>
|
||||
<x-th class="text-right">Aksi</x-th>
|
||||
</x-slot>
|
||||
|
||||
@forelse ($buku as $item)
|
||||
<tr class="hover:bg-gray-50 transition-colors">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-bold text-gray-900">{{ $item->bibid }}</td>
|
||||
<td class="px-6 py-4">
|
||||
<div class="text-sm font-bold text-gray-900">{{ $item->judul }}</div>
|
||||
<div class="text-sm text-gray-500">{{ $item->pengarang }}</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $item->kategori->nama_kategori ?? 'Umum' }}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $item->eksemplar }}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
<div class="flex justify-end gap-3">
|
||||
<a href="{{ route('admin.buku.edit', $item->id_buku) }}" class="text-blue-600 hover:text-blue-900">
|
||||
Edit
|
||||
</a>
|
||||
<form action="{{ route('admin.buku.destroy', $item->id_buku) }}"
|
||||
method="POST"
|
||||
onsubmit="return confirm('Apakah Anda yakin ingin menghapus aset buku ini?')">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="text-red-600 hover:text-red-900 font-medium transition duration-150 ease-in-out">
|
||||
Hapus
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="5" class="px-6 py-8 text-center text-sm text-gray-500">
|
||||
Tidak ada data aset buku ditemukan.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</x-table>
|
||||
|
||||
<div class="mt-4">
|
||||
{{ $buku->withQueryString()->links() }}
|
||||
</div>
|
||||
</x-card>
|
||||
<!-- MODAL TAMBAH BUKU -->
|
||||
<div x-show="isModalBukuOpen" style="display: none;" class="fixed inset-0 z-50 overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true">
|
||||
<div class="flex items-end justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0">
|
||||
<!-- Background overlay -->
|
||||
<div x-show="isModalBukuOpen" x-transition.opacity class="fixed inset-0 transition-opacity bg-gray-900/60 backdrop-blur-sm" aria-hidden="true" @click="isModalBukuOpen = false"></div>
|
||||
|
||||
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
|
||||
|
||||
<!-- Modal panel -->
|
||||
<div x-show="isModalBukuOpen"
|
||||
x-transition:enter="ease-out duration-300"
|
||||
x-transition:enter-start="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
||||
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave="ease-in duration-200"
|
||||
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave-end="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
||||
class="inline-block px-4 pt-5 pb-4 overflow-hidden text-left align-bottom transition-all transform bg-white rounded-3xl shadow-2xl shadow-indigo-500/10 sm:my-8 sm:align-middle sm:max-w-4xl sm:w-full sm:p-8 border border-gray-100">
|
||||
|
||||
<div class="flex justify-between items-center mb-6 pl-2">
|
||||
<div>
|
||||
<h3 class="text-2xl font-bold text-gray-900" id="modal-title">Tambah Koleksi Buku</h3>
|
||||
<p class="text-sm text-gray-500 mt-1">Masukkan detail buku baru ke dalam katalog perpustakaan.</p>
|
||||
</div>
|
||||
<button @click="isModalBukuOpen = false" class="w-10 h-10 rounded-full bg-gray-50 hover:bg-red-50 text-gray-400 hover:text-red-500 flex items-center justify-center transition-colors">
|
||||
<i class="fas fa-times text-lg"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="bg-red-50 border-l-4 border-red-500 text-red-700 p-4 mb-6 rounded-r-xl text-sm shadow-sm" role="alert">
|
||||
<p class="font-bold mb-1"><i class="fas fa-exclamation-circle mr-1"></i> Validasi Gagal</p>
|
||||
<ul class="list-disc ml-5 space-y-1">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form action="{{ route('admin.buku.store') }}" method="POST" enctype="multipart/form-data" class="space-y-6">
|
||||
@csrf
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<x-input-label for="bibid" value="BIBID" />
|
||||
<x-text-input id="bibid" name="bibid" type="text" class="mt-1 block w-full bg-gray-50/50" :value="old('bibid')" required />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="id_kategori" value="Kategori" />
|
||||
<select id="id_kategori" name="id_kategori" class="mt-1 block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-xl shadow-sm bg-gray-50/50" required>
|
||||
<option value="">Pilih Kategori</option>
|
||||
@foreach($kategori as $kat)
|
||||
<option value="{{ $kat->id_kategori }}" {{ old('id_kategori') == $kat->id_kategori ? 'selected' : '' }}>
|
||||
{{ $kat->nama_kategori }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="judul" value="Judul Buku" />
|
||||
<x-text-input id="judul" name="judul" type="text" class="mt-1 block w-full bg-gray-50/50" :value="old('judul')" required />
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<x-input-label for="pengarang" value="Pengarang" />
|
||||
<x-text-input id="pengarang" name="pengarang" type="text" class="mt-1 block w-full bg-gray-50/50" :value="old('pengarang')" required />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="nomor_panggil" value="Nomor Panggil (DDC)" />
|
||||
<x-text-input id="nomor_panggil" name="nomor_panggil" type="text" class="mt-1 block w-full bg-gray-50/50" :value="old('nomor_panggil')" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
<div>
|
||||
<x-input-label for="penerbit" value="Penerbit" />
|
||||
<x-text-input id="penerbit" name="penerbit" type="text" class="mt-1 block w-full bg-gray-50/50" :value="old('penerbit')" />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="tahun_terbit" value="Tahun Terbit" />
|
||||
<x-text-input id="tahun_terbit" name="tahun_terbit" type="number" class="mt-1 block w-full bg-gray-50/50" :value="old('tahun_terbit')" />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="edisi" value="Edisi" />
|
||||
<x-text-input id="edisi" name="edisi" type="text" class="mt-1 block w-full bg-gray-50/50" :value="old('edisi')" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<x-input-label for="deskripsi_fisik" value="Deskripsi Fisik" />
|
||||
<x-text-input id="deskripsi_fisik" name="deskripsi_fisik" type="text" class="mt-1 block w-full bg-gray-50/50" :value="old('deskripsi_fisik')" />
|
||||
</div>
|
||||
<div>
|
||||
<x-input-label for="eksemplar" value="Jumlah Eksemplar" />
|
||||
<x-text-input id="eksemplar" name="eksemplar" type="number" class="mt-1 block w-full bg-gray-50/50" :value="old('eksemplar')" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="border-t border-gray-100 pt-6">
|
||||
<x-input-label for="cover" value="Unggah Gambar Cover (Opsional)" class="mb-2" />
|
||||
<div class="flex items-center justify-center w-full">
|
||||
<label for="cover" class="flex flex-col items-center justify-center w-full h-32 border-2 border-dashed border-indigo-200 rounded-2xl cursor-pointer bg-indigo-50/30 hover:bg-indigo-50 transition-colors">
|
||||
<div class="flex flex-col items-center justify-center pt-5 pb-6">
|
||||
<i class="fas fa-cloud-upload-alt text-3xl text-indigo-400 mb-2"></i>
|
||||
<p class="mb-1 text-sm text-gray-500"><span class="font-semibold text-indigo-600">Klik untuk unggah</span> atau seret file ke sini</p>
|
||||
<p class="text-xs text-gray-400">PNG, JPG, JPEG (Maks. 2MB)</p>
|
||||
</div>
|
||||
<input id="cover" name="cover" type="file" class="hidden" accept="image/jpeg, image/png, image/jpg" />
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 pt-6 border-t border-gray-100 mt-8">
|
||||
<button type="button" @click="isModalBukuOpen = false" class="px-5 py-2.5 text-gray-600 bg-gray-100 hover:bg-gray-200 hover:text-gray-900 rounded-xl font-semibold transition-colors">
|
||||
Batal
|
||||
</button>
|
||||
<button type="submit" class="bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white px-6 py-2.5 rounded-xl font-bold shadow-lg shadow-blue-500/30 transition-all transform hover:scale-105">
|
||||
<i class="fas fa-save mr-2"></i> Simpan Buku
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
@extends('layouts.admin')
|
||||
|
||||
@section('title', 'Dashboard')
|
||||
|
||||
@section('content')
|
||||
{{-- Banner Selamat Datang --}}
|
||||
<div class="relative w-full rounded-[2rem] bg-gradient-to-r from-primary-600 via-primary-700 to-indigo-900 overflow-hidden shadow-2xl shadow-primary-500/20 mb-10 border border-white/10">
|
||||
{{-- Background Dekoratif --}}
|
||||
<div class="absolute inset-0 bg-[url('https://www.transparenttextures.com/patterns/cubes.png')] opacity-10 mix-blend-overlay"></div>
|
||||
<div class="absolute top-0 right-0 -mr-20 -mt-20 w-72 h-72 rounded-full bg-white/10 blur-3xl mix-blend-overlay"></div>
|
||||
<div class="absolute bottom-0 right-40 w-40 h-40 rounded-full bg-blue-400/20 blur-2xl"></div>
|
||||
|
||||
<div class="relative z-10 px-8 py-10 md:py-14 flex flex-col md:flex-row items-center justify-between gap-6">
|
||||
<div class="text-white">
|
||||
<div class="inline-flex items-center gap-2 px-3 py-1.5 bg-white/10 backdrop-blur-md rounded-full mb-4 border border-white/20">
|
||||
<i class="fas fa-calendar-alt text-primary-200 text-xs"></i>
|
||||
<span class="text-xs font-semibold tracking-wide text-primary-100">{{ now()->translatedFormat('l, d F Y') }}</span>
|
||||
</div>
|
||||
<h1 class="text-3xl md:text-4xl font-black mb-2 tracking-tight">
|
||||
Selamat Datang, <span class="text-transparent bg-clip-text bg-gradient-to-r from-blue-200 to-indigo-100">{{ auth()->user()->name ?? 'Admin' }}!</span>
|
||||
</h1>
|
||||
<p class="text-primary-100/80 max-w-lg text-sm md:text-base leading-relaxed">
|
||||
Pantau aktivitas perpustakaan hari ini. Kelola koleksi buku Anda dan berikan pelayanan terbaik bagi anggota.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Jam Digital Sederhana (Opsional & Dekoratif) -->
|
||||
<div class="hidden md:flex flex-col items-center justify-center p-5 bg-white/10 backdrop-blur-md border border-white/20 rounded-3xl shadow-lg ring-1 ring-white/10">
|
||||
<i class="fas fa-clock text-primary-200 text-3xl mb-2 opacity-80 animate-pulse"></i>
|
||||
<div class="text-xs font-bold text-white uppercase tracking-widest bg-primary-900/50 px-3 py-1 rounded-full text-center">
|
||||
Aktivitas<br>Realtime
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Grid Kartu Statistik --}}
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 mb-10">
|
||||
{{-- Total Buku --}}
|
||||
<div class="group bg-white rounded-[1.5rem] p-6 border-0 shadow-lg shadow-gray-200/50 hover:shadow-2xl hover:shadow-primary-500/30 transition-all duration-300 transform hover:-translate-y-2 relative overflow-hidden">
|
||||
<div class="absolute -right-6 -top-6 w-24 h-24 rounded-full bg-primary-50 opacity-50 group-hover:scale-150 transition-transform duration-500 ease-out"></div>
|
||||
|
||||
<div class="flex items-center justify-between relative z-10 mb-6">
|
||||
<div class="w-14 h-14 bg-gradient-to-br from-primary-500 to-primary-600 text-white rounded-2xl flex items-center justify-center shadow-md shadow-primary-200 group-hover:rotate-12 transition-transform duration-300">
|
||||
<i class="fas fa-book text-xl"></i>
|
||||
</div>
|
||||
<span class="flex items-center gap-1 text-[11px] font-bold text-green-600 bg-green-50 px-3 py-1.5 rounded-full border border-green-100 shadow-sm">
|
||||
<i class="fas fa-check-circle"></i> Sistem
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="relative z-10">
|
||||
<p class="text-4xl font-black text-gray-900 tracking-tight">{{ number_format($totalBuku ?? 0) }}</p>
|
||||
<p class="text-sm text-gray-400 font-medium mt-1">Total Koleksi Buku</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Total Anggota --}}
|
||||
<div class="group bg-white rounded-[1.5rem] p-6 border-0 shadow-lg shadow-gray-200/50 hover:shadow-2xl hover:shadow-emerald-500/30 transition-all duration-300 transform hover:-translate-y-2 relative overflow-hidden">
|
||||
<div class="absolute -right-6 -top-6 w-24 h-24 rounded-full bg-emerald-50 opacity-50 group-hover:scale-150 transition-transform duration-500 ease-out"></div>
|
||||
|
||||
<div class="flex items-center justify-between relative z-10 mb-6">
|
||||
<div class="w-14 h-14 bg-gradient-to-br from-emerald-500 to-emerald-600 text-white rounded-2xl flex items-center justify-center shadow-md shadow-emerald-200 group-hover:rotate-12 transition-transform duration-300">
|
||||
<i class="fas fa-users text-xl"></i>
|
||||
</div>
|
||||
<span class="flex items-center gap-1 text-[11px] font-bold text-green-600 bg-green-50 px-3 py-1.5 rounded-full border border-green-100 shadow-sm">
|
||||
<i class="fas fa-check-circle"></i> Aktif
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="relative z-10">
|
||||
<p class="text-4xl font-black text-gray-900 tracking-tight">{{ number_format($totalAnggota ?? 0) }}</p>
|
||||
<p class="text-sm text-gray-400 font-medium mt-1">Anggota Terdaftar</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Peminjaman Hari Ini --}}
|
||||
<div class="group bg-white rounded-[1.5rem] p-6 border-0 shadow-lg shadow-gray-200/50 hover:shadow-2xl hover:shadow-amber-500/30 transition-all duration-300 transform hover:-translate-y-2 relative overflow-hidden">
|
||||
<div class="absolute -right-6 -top-6 w-24 h-24 rounded-full bg-amber-50 opacity-50 group-hover:scale-150 transition-transform duration-500 ease-out"></div>
|
||||
|
||||
<div class="flex items-center justify-between relative z-10 mb-6">
|
||||
<div class="w-14 h-14 bg-gradient-to-br from-amber-500 to-amber-600 text-white rounded-2xl flex items-center justify-center shadow-md shadow-amber-200 group-hover:-rotate-12 transition-transform duration-300">
|
||||
<i class="fas fa-exchange-alt text-xl"></i>
|
||||
</div>
|
||||
<span class="flex items-center gap-1 text-[11px] font-bold text-amber-600 bg-amber-50 px-3 py-1.5 rounded-full border border-amber-100 shadow-sm">
|
||||
<i class="fas fa-bolt"></i> Hari Ini
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="relative z-10">
|
||||
<p class="text-4xl font-black text-gray-900 tracking-tight">{{ number_format($totalPeminjamanHariIni ?? 0) }}</p>
|
||||
<p class="text-sm text-gray-400 font-medium mt-1">Sirkulasi Peminjaman</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Total Pengunjung/Tamu --}}
|
||||
<div class="group bg-white rounded-[1.5rem] p-6 border-0 shadow-lg shadow-gray-200/50 hover:shadow-2xl hover:shadow-purple-500/30 transition-all duration-300 transform hover:-translate-y-2 relative overflow-hidden">
|
||||
<div class="absolute -right-6 -top-6 w-24 h-24 rounded-full bg-purple-50 opacity-50 group-hover:scale-150 transition-transform duration-500 ease-out"></div>
|
||||
|
||||
<div class="flex items-center justify-between relative z-10 mb-6">
|
||||
<div class="w-14 h-14 bg-gradient-to-br from-purple-500 to-purple-600 text-white rounded-2xl flex items-center justify-center shadow-md shadow-purple-200 group-hover:rotate-12 transition-transform duration-300">
|
||||
<i class="fas fa-clipboard-list text-xl"></i>
|
||||
</div>
|
||||
<span class="flex items-center gap-1 text-[11px] font-bold text-purple-600 bg-purple-50 px-3 py-1.5 rounded-full border border-purple-100 shadow-sm">
|
||||
<i class="fas fa-chart-line"></i> Tercatat
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="relative z-10">
|
||||
<p class="text-4xl font-black text-gray-900 tracking-tight">{{ number_format($totalBukuTamu ?? 0) }}</p>
|
||||
<p class="text-sm text-gray-400 font-medium mt-1">Total Pengunjung</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Menu Aksi Cepat / Quick Actions --}}
|
||||
<div class="bg-white rounded-[2rem] p-8 shadow-xl shadow-gray-200/40 border border-gray-50 flex flex-col md:flex-row items-center justify-between gap-6 relative overflow-hidden">
|
||||
<div class="absolute right-0 bottom-0 w-64 h-64 bg-gradient-to-tl from-gray-50 to-transparent rounded-tl-full opacity-50"></div>
|
||||
|
||||
<div class="relative z-10">
|
||||
<h3 class="text-xl font-bold text-gray-900 mb-1">Aksi Cepat Admin</h3>
|
||||
<p class="text-sm text-gray-500">Akses langsung ke menu-menu operasional paling sering digunakan.</p>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-3 relative z-10">
|
||||
<a href="{{ route('admin.buku.index', ['add' => 'true']) }}" class="px-5 py-2.5 bg-gray-50 hover:bg-primary-50 text-gray-700 hover:text-primary-700 font-semibold rounded-xl border border-gray-200 hover:border-primary-200 transition-all shadow-sm flex items-center gap-2">
|
||||
<i class="fas fa-plus text-xs"></i> Tambah Buku Baru
|
||||
</a>
|
||||
<a href="{{ route('admin.peminjaman.index', ['add' => 'true']) }}" class="px-5 py-2.5 bg-gray-50 hover:bg-amber-50 text-gray-700 hover:text-amber-700 font-semibold rounded-xl border border-gray-200 hover:border-amber-200 transition-all shadow-sm flex items-center gap-2">
|
||||
<i class="fas fa-hand-holding-usd text-xs"></i> Catat Peminjaman
|
||||
</a>
|
||||
<a href="{{ route('admin.laporan.peminjaman') }}" class="px-5 py-2.5 bg-primary-600 hover:bg-primary-700 text-white font-bold rounded-xl shadow-md cursor-pointer transition-colors flex items-center gap-2">
|
||||
<i class="fas fa-print text-xs"></i> Cetak Laporan
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Widget Tambahan: Buku Terpopuler --}}
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6 mt-6">
|
||||
<h3 class="text-lg font-bold text-gray-900 mb-4 border-b pb-2">Top 5 Buku Terpopuler</h3>
|
||||
<ul class="divide-y divide-gray-100">
|
||||
@forelse($bukuPopuler as $buku)
|
||||
<li class="py-3 flex justify-between items-center">
|
||||
<div>
|
||||
<p class="font-bold text-sm text-gray-800">{{ $buku->judul }}</p>
|
||||
<p class="text-xs text-gray-500">{{ $buku->pengarang }}</p>
|
||||
</div>
|
||||
<span class="bg-blue-100 text-blue-800 text-xs font-bold px-3 py-1 rounded-full">
|
||||
{{ $buku->peminjaman_count }} Peminjaman
|
||||
</span>
|
||||
</li>
|
||||
@empty
|
||||
<li class="py-3 text-sm text-gray-500">Belum ada data peminjaman.</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container mx-auto px-4 py-8 max-w-2xl">
|
||||
<div class="bg-white shadow-lg rounded-xl overflow-hidden border border-gray-100">
|
||||
<div class="p-6 bg-blue-50 border-b border-blue-100">
|
||||
<h1 class="text-2xl font-extrabold text-blue-900">Formulir Peminjaman Aset</h1>
|
||||
</div>
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4 m-6 mb-0" role="alert">
|
||||
<p class="font-bold">Validasi Gagal</p>
|
||||
<ul class="list-disc ml-5">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form action="{{ route('admin.peminjaman.store') }}" method="POST" class="p-6 space-y-6" id="form-peminjaman">
|
||||
@csrf
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">Pilih Anggota / Member</label>
|
||||
<select name="id_anggota" class="w-full border-gray-300 rounded-lg shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
||||
<option value="">-- Pilih Member --</option>
|
||||
@foreach($anggota as $a)
|
||||
<option value="{{ $a->id }}" {{ old('id_anggota') == $a->id ? 'selected' : '' }}>
|
||||
{{ $a->nama }} ({{ $a->no_identitas }})
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">Pilih Aset Buku (Hanya yang tersedia)</label>
|
||||
<select name="id_buku" class="w-full border-gray-300 rounded-lg shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
||||
<option value="">-- Pilih Buku --</option>
|
||||
@foreach($buku as $b)
|
||||
<option value="{{ $b->id_buku }}" {{ old('id_buku') == $b->id_buku ? 'selected' : '' }}>
|
||||
{{ $b->bibid }} - {{ $b->judul }} (Stok: {{ $b->eksemplar }})
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">Tanggal Pinjam</label>
|
||||
<input type="date" name="tanggal_pinjam" value="{{ old('tanggal_pinjam', date('Y-m-d')) }}" class="w-full border-gray-300 rounded-lg shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">Tanggal Kembali (Tenggat)</label>
|
||||
<input type="date" name="tanggal_kembali" value="{{ old('tanggal_kembali', date('Y-m-d', strtotime('+7 days'))) }}" class="w-full border-gray-300 rounded-lg shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pt-6 border-t border-gray-100 flex justify-between items-center">
|
||||
<a href="{{ route('admin.peminjaman.index') }}" class="text-gray-600 hover:text-gray-900 font-medium transition duration-300">Batal</a>
|
||||
<button type="submit" id="btn-submit" class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-8 rounded-lg shadow-md transition duration-300 ease-in-out">
|
||||
Eksekusi Transaksi
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('form-peminjaman').addEventListener('submit', function() {
|
||||
const btn = document.getElementById('btn-submit');
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = 'Memproses...';
|
||||
btn.classList.add('opacity-50', 'cursor-not-allowed');
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue