Initial commit
This commit is contained in:
commit
5262a455e8
|
|
@ -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,10 @@
|
||||||
|
* 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
|
||||||
|
public/pdf/magazine.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
|
@ -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,10 @@
|
||||||
|
# Pustaka Nawasena
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
||||||
|
|
||||||
|
- Add your files from your local project
|
||||||
|
- Edit README as needed
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
|
|
||||||
|
class SetupLanguages extends Command
|
||||||
|
{
|
||||||
|
protected $signature = 'lang:setup';
|
||||||
|
protected $description = 'Membuat dan mengisi file bahasa Indonesia dan Inggris secara otomatis';
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$langPath = resource_path('lang');
|
||||||
|
|
||||||
|
// Buat folder lang kalau belum ada
|
||||||
|
if (!File::exists($langPath)) {
|
||||||
|
File::makeDirectory($langPath, 0755, true);
|
||||||
|
$this->info('📁 Folder "resources/lang" berhasil dibuat.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Isi default Bahasa Indonesia
|
||||||
|
$idData = [
|
||||||
|
"Welcome" => "Selamat Datang",
|
||||||
|
"Search" => "Pencarian",
|
||||||
|
"Book Collection" => "Koleksi Buku",
|
||||||
|
"Language" => "Bahasa",
|
||||||
|
"Filter" => "Filter",
|
||||||
|
"Apply" => "Terapkan",
|
||||||
|
"Reset" => "Atur Ulang",
|
||||||
|
"Available" => "Tersedia",
|
||||||
|
"Borrowed" => "Dipinjam"
|
||||||
|
];
|
||||||
|
|
||||||
|
// Isi default Bahasa Inggris
|
||||||
|
$enData = [
|
||||||
|
"Welcome" => "Welcome",
|
||||||
|
"Search" => "Search",
|
||||||
|
"Book Collection" => "Book Collection",
|
||||||
|
"Language" => "Language",
|
||||||
|
"Filter" => "Filter",
|
||||||
|
"Apply" => "Apply",
|
||||||
|
"Reset" => "Reset",
|
||||||
|
"Available" => "Available",
|
||||||
|
"Borrowed" => "Borrowed"
|
||||||
|
];
|
||||||
|
|
||||||
|
// Simpan file JSON
|
||||||
|
File::put($langPath . '/id.json', json_encode($idData, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||||
|
File::put($langPath . '/en.json', json_encode($enData, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||||
|
|
||||||
|
$this->info('✅ File bahasa "id.json" dan "en.json" berhasil dibuat dan diisi.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Resources\BookResource\Pages;
|
||||||
|
use App\Models\Book;
|
||||||
|
use Filament\Forms;
|
||||||
|
use Filament\Tables;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\Section;
|
||||||
|
use Filament\Forms\Components\Grid;
|
||||||
|
|
||||||
|
class BookResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = Book::class;
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-book-open';
|
||||||
|
protected static ?string $navigationLabel = 'Manajemen Koleksi';
|
||||||
|
protected static ?string $pluralLabel = 'Koleksi Buku';
|
||||||
|
protected static ?string $slug = 'books';
|
||||||
|
protected static ?string $navigationGroup = '📚 Manajemen Perpustakaan';
|
||||||
|
|
||||||
|
public static function form(Forms\Form $form): Forms\Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->schema([
|
||||||
|
Section::make('Informasi Buku')
|
||||||
|
->description('Lengkapi data bibliografi koleksi perpustakaan.')
|
||||||
|
->schema([
|
||||||
|
Grid::make(2)->schema([
|
||||||
|
TextInput::make('judul')
|
||||||
|
->label('Judul Buku')
|
||||||
|
->required()
|
||||||
|
->maxLength(255),
|
||||||
|
|
||||||
|
TextInput::make('penulis')
|
||||||
|
->label('Penulis')
|
||||||
|
->maxLength(255),
|
||||||
|
|
||||||
|
TextInput::make('penerbit')
|
||||||
|
->label('Penerbit')
|
||||||
|
->maxLength(255),
|
||||||
|
|
||||||
|
TextInput::make('tahun_terbit')
|
||||||
|
->label('Tahun Terbit')
|
||||||
|
->numeric()
|
||||||
|
->minValue(1900)
|
||||||
|
->maxValue(date('Y')),
|
||||||
|
|
||||||
|
Select::make('kategori')
|
||||||
|
->label('Kategori')
|
||||||
|
->options([
|
||||||
|
'Fiksi' => 'Fiksi',
|
||||||
|
'Non-Fiksi' => 'Non-Fiksi',
|
||||||
|
'Jurnal' => 'Jurnal',
|
||||||
|
'Referensi' => 'Referensi',
|
||||||
|
'Lainnya' => 'Lainnya',
|
||||||
|
]),
|
||||||
|
|
||||||
|
TextInput::make('jumlah_eksemplar')
|
||||||
|
->label('Jumlah Eksemplar')
|
||||||
|
->numeric()
|
||||||
|
->default(1)
|
||||||
|
->minValue(1),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Tables\Table $table): Tables\Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
TextColumn::make('judul')->label('Judul Buku')->searchable()->sortable(),
|
||||||
|
TextColumn::make('penulis')->label('Penulis')->sortable(),
|
||||||
|
TextColumn::make('penerbit')->label('Penerbit')->sortable(),
|
||||||
|
TextColumn::make('tahun_terbit')->label('Tahun'),
|
||||||
|
TextColumn::make('kategori')->label('Kategori')->badge(),
|
||||||
|
TextColumn::make('jumlah_eksemplar')->label('Stok')->color('success'),
|
||||||
|
TextColumn::make('created_at')->label('Ditambahkan')->date(),
|
||||||
|
])
|
||||||
|
->defaultSort('created_at', 'desc');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListBooks::route('/'),
|
||||||
|
'create' => Pages\CreateBook::route('/create'),
|
||||||
|
'edit' => Pages\EditBook::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\BookResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\BookResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateBook extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = BookResource::class;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\BookResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\BookResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditBook extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = BookResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\BookResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\BookResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListBooks extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = BookResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Resources\MemberResource\Pages;
|
||||||
|
use App\Filament\Resources\MemberResource\RelationManagers;
|
||||||
|
use App\Models\Member;
|
||||||
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
|
|
||||||
|
class MemberResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = Member::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->schema([
|
||||||
|
//
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
//
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
//
|
||||||
|
])
|
||||||
|
->actions([
|
||||||
|
Tables\Actions\EditAction::make(),
|
||||||
|
])
|
||||||
|
->bulkActions([
|
||||||
|
Tables\Actions\BulkActionGroup::make([
|
||||||
|
Tables\Actions\DeleteBulkAction::make(),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListMembers::route('/'),
|
||||||
|
'create' => Pages\CreateMember::route('/create'),
|
||||||
|
'edit' => Pages\EditMember::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\MemberResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\MemberResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateMember extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = MemberResource::class;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\MemberResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\MemberResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditMember extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = MemberResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\MemberResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\MemberResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListMembers extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = MemberResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,123 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Anggota;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||||
|
use App\Mail\StatusAnggotaDiperbarui;
|
||||||
|
|
||||||
|
class AnggotaController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$query = $request->input('search');
|
||||||
|
$status = $request->input('status');
|
||||||
|
|
||||||
|
$members = Anggota::when($query, function ($q) use ($query) {
|
||||||
|
$q->where('nama', 'like', "%{$query}%")
|
||||||
|
->orWhere('email', 'like', "%{$query}%");
|
||||||
|
})
|
||||||
|
->when($status, function ($q) use ($status) {
|
||||||
|
$q->where('status', $status);
|
||||||
|
})
|
||||||
|
->orderByDesc('created_at')
|
||||||
|
->paginate(10)
|
||||||
|
->withQueryString();
|
||||||
|
|
||||||
|
return view('admin.anggota.index', compact('members'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.anggota.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$validatedData = $request->validate([
|
||||||
|
'nama' => 'required|string|max:100',
|
||||||
|
'email' => 'required|email|unique:anggota,email',
|
||||||
|
'alamat' => 'required|string|max:255',
|
||||||
|
'no_hp' => 'nullable|string|max:20',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$validatedData['status'] = 'disetujui';
|
||||||
|
|
||||||
|
Anggota::create($validatedData);
|
||||||
|
|
||||||
|
return redirect()->route('admin.anggota.index')
|
||||||
|
->with('success', 'Anggota baru berhasil didaftarkan dan disetujui!');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$member = Anggota::findOrFail($id);
|
||||||
|
return view('admin.anggota.edit', compact('member'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$member = Anggota::findOrFail($id);
|
||||||
|
|
||||||
|
$validatedData = $request->validate([
|
||||||
|
'nama' => 'required|string|max:100',
|
||||||
|
'email' => 'required|email|unique:anggota,email,' . $member->id,
|
||||||
|
'alamat' => 'required|string|max:255',
|
||||||
|
'no_hp' => 'nullable|string|max:20',
|
||||||
|
'status' => 'required|in:menunggu,disetujui,ditolak',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$member->update($validatedData);
|
||||||
|
|
||||||
|
return redirect()->route('admin.anggota.index')
|
||||||
|
->with('success', 'Data anggota berhasil diperbarui!');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$member = Anggota::findOrFail($id);
|
||||||
|
$member->delete();
|
||||||
|
|
||||||
|
return redirect()->route('admin.anggota.index')
|
||||||
|
->with('success', 'Anggota berhasil dihapus!');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function cetak($id)
|
||||||
|
{
|
||||||
|
$member = Anggota::findOrFail($id);
|
||||||
|
$qrCode = base64_encode(QrCode::format('svg')->size(120)->generate($member->nama));
|
||||||
|
|
||||||
|
return view('admin.anggota.cetak', compact('member', 'qrCode'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function approve($id)
|
||||||
|
{
|
||||||
|
$member = Anggota::findOrFail($id);
|
||||||
|
$member->update(['status' => 'disetujui']);
|
||||||
|
|
||||||
|
Mail::to($member->email)->send(new StatusAnggotaDiperbarui($member));
|
||||||
|
|
||||||
|
return back()->with('success', "Anggota {$member->nama} telah disetujui.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reject($id)
|
||||||
|
{
|
||||||
|
$member = Anggota::findOrFail($id);
|
||||||
|
$member->update(['status' => 'ditolak']);
|
||||||
|
|
||||||
|
Mail::to($member->email)->send(new StatusAnggotaDiperbarui($member));
|
||||||
|
|
||||||
|
return back()->with('warning', "Anggota {$member->nama} telah ditolak.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Anggota;
|
||||||
|
use App\Models\Koleksi;
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
use App\Models\Rating;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class DashboardController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$jumlahJudul = Koleksi::distinct('title')->count('title');
|
||||||
|
|
||||||
|
$jumlahEksemplar = Koleksi::whereNotNull('kode_eksemplar')->count();
|
||||||
|
|
||||||
|
$jumlahUser = User::count();
|
||||||
|
|
||||||
|
$totalBuku = $jumlahJudul;
|
||||||
|
$totalAnggota = $jumlahUser;
|
||||||
|
|
||||||
|
$anggotaBulanIni = Anggota::whereMonth('created_at', date('m'))->count();
|
||||||
|
|
||||||
|
|
||||||
|
$totalPeminjaman = BorrowTransaction::where('status', 'dipinjam')->count();
|
||||||
|
|
||||||
|
$totalPengembalian = BorrowTransaction::where('status', 'dikembalikan')->count();
|
||||||
|
|
||||||
|
|
||||||
|
$chartData = BorrowTransaction::selectRaw('MONTH(tanggal_pinjam) as bulan, COUNT(*) as total')
|
||||||
|
->whereYear('tanggal_pinjam', date('Y'))
|
||||||
|
->groupBy('bulan')
|
||||||
|
->orderBy('bulan')
|
||||||
|
->pluck('total', 'bulan')
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$chartDataFull = [];
|
||||||
|
for ($i = 1; $i <= 12; $i++) {
|
||||||
|
$chartDataFull[] = $chartData[$i] ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$bulanLabel = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agu', 'Sep', 'Okt', 'Nov', 'Des'];
|
||||||
|
|
||||||
|
|
||||||
|
$ratings = Rating::with('user', 'transaction.koleksi')->orderBy('created_at', 'desc')->get();
|
||||||
|
|
||||||
|
$ratingCounts = [];
|
||||||
|
$ratingComments = [];
|
||||||
|
for ($i = 1; $i <= 5; $i++) {
|
||||||
|
$ratingCounts[$i] = $ratings->where('rating', $i)->count();
|
||||||
|
$ratingComments[$i] = $ratings->where('rating', $i)->pluck('feedback')->implode(', ');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$mostBorrowedBook = BorrowTransaction::select('koleksi_id')
|
||||||
|
->selectRaw('COUNT(*) as total')
|
||||||
|
->groupBy('koleksi_id')
|
||||||
|
->orderByDesc('total')
|
||||||
|
->with('koleksi')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
|
||||||
|
return view('admin.dashboard', compact(
|
||||||
|
'jumlahJudul',
|
||||||
|
'jumlahEksemplar',
|
||||||
|
'jumlahUser',
|
||||||
|
'totalBuku',
|
||||||
|
'totalAnggota',
|
||||||
|
'anggotaBulanIni',
|
||||||
|
'totalPeminjaman',
|
||||||
|
'totalPengembalian',
|
||||||
|
'chartDataFull',
|
||||||
|
'bulanLabel',
|
||||||
|
'ratings',
|
||||||
|
'ratingCounts',
|
||||||
|
'ratingComments',
|
||||||
|
'mostBorrowedBook'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,234 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Koleksi;
|
||||||
|
use App\Models\Publisher;
|
||||||
|
use App\Models\PublishPlace;
|
||||||
|
use App\Models\Setting;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
|
use Milon\Barcode\DNS1D;
|
||||||
|
|
||||||
|
class KoleksiController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$query = Koleksi::query();
|
||||||
|
|
||||||
|
if ($request->filled('search')) {
|
||||||
|
$search = $request->search;
|
||||||
|
$query->where(function ($q) use ($search) {
|
||||||
|
$q->where('title', 'like', "%{$search}%")
|
||||||
|
->orWhere('sor', 'like', "%{$search}%")
|
||||||
|
->orWhere('classification', 'like', "%{$search}%")
|
||||||
|
->orWhere('kode_eksemplar', 'like', "%{$search}%");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = $query->orderBy('input_date', 'desc')
|
||||||
|
->paginate(20)
|
||||||
|
->withQueryString();
|
||||||
|
|
||||||
|
return view('admin.koleksi.index', compact('results'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$publishers = Publisher::all();
|
||||||
|
$publishPlaces = PublishPlace::all();
|
||||||
|
|
||||||
|
return view('admin.koleksi.create', compact('publishers', 'publishPlaces'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'title' => 'required|string|max:255',
|
||||||
|
'sor' => 'nullable|string|max:255',
|
||||||
|
'jumlah_eksemplar' => 'required|integer|min:1',
|
||||||
|
'publisher_name' => 'nullable|string|max:255',
|
||||||
|
'publish_place_name' => 'nullable|string|max:255',
|
||||||
|
'publish_year' => 'nullable|integer',
|
||||||
|
'isbn_issn' => 'nullable|string|max:50',
|
||||||
|
'edition' => 'nullable|string|max:100',
|
||||||
|
'classification' => 'nullable|string|max:100',
|
||||||
|
'labels' => 'nullable|string|max:255',
|
||||||
|
'image' => 'nullable|file|mimes:jpg,jpeg,png,gif',
|
||||||
|
'opac_hide' => 'nullable|boolean',
|
||||||
|
'promoted' => 'nullable|boolean',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$jumlah = $request->jumlah_eksemplar;
|
||||||
|
$imagePath = $request->hasFile('image') ? $request->file('image')->store('images', 'public') : null;
|
||||||
|
|
||||||
|
for ($i = 1; $i <= $jumlah; $i++) {
|
||||||
|
$kodeEksemplar = $this->generateKodeEksemplar();
|
||||||
|
$barcodePath = $this->generateBarcode($kodeEksemplar);
|
||||||
|
|
||||||
|
Koleksi::create([
|
||||||
|
'title' => $request->title,
|
||||||
|
'sor' => $request->sor,
|
||||||
|
'publisher_name' => $request->publisher_name,
|
||||||
|
'publish_place_name' => $request->publish_place_name,
|
||||||
|
'publish_year' => $request->publish_year,
|
||||||
|
'isbn_issn' => $request->isbn_issn,
|
||||||
|
'edition' => $request->edition,
|
||||||
|
'classification' => $request->classification,
|
||||||
|
'labels' => $request->labels,
|
||||||
|
'image' => $imagePath,
|
||||||
|
'barcode' => $barcodePath,
|
||||||
|
'kode_eksemplar' => $kodeEksemplar,
|
||||||
|
'input_date' => now(),
|
||||||
|
'last_update' => now(),
|
||||||
|
'uid' => auth()->id(),
|
||||||
|
'opac_hide' => $request->opac_hide ?? 0,
|
||||||
|
'promoted' => $request->promoted ?? 0,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('admin.koleksi.index')
|
||||||
|
->with('success', '✅ Koleksi berhasil ditambahkan dengan Barcode.');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generateKodeEksemplar()
|
||||||
|
{
|
||||||
|
do {
|
||||||
|
$random = str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
|
||||||
|
$kode = 'P' . $random . 'S';
|
||||||
|
} while (Koleksi::where('kode_eksemplar', $kode)->exists());
|
||||||
|
|
||||||
|
return $kode;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generateBarcode($kodeEksemplar)
|
||||||
|
{
|
||||||
|
$barcode = new DNS1D();
|
||||||
|
$barcode->setStorPath(storage_path('app/public/barcodes'));
|
||||||
|
|
||||||
|
if (!Storage::disk('public')->exists('barcodes')) {
|
||||||
|
Storage::disk('public')->makeDirectory('barcodes');
|
||||||
|
}
|
||||||
|
|
||||||
|
$barcodePng = $barcode->getBarcodePNG($kodeEksemplar, 'C39+', 3, 100);
|
||||||
|
$barcodePath = "barcodes/{$kodeEksemplar}.png";
|
||||||
|
|
||||||
|
Storage::disk('public')->put($barcodePath, base64_decode($barcodePng));
|
||||||
|
|
||||||
|
return $barcodePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function printBarcodeSingle($kode_eksemplar)
|
||||||
|
{
|
||||||
|
$koleksi = Koleksi::where('kode_eksemplar', $kode_eksemplar)->firstOrFail();
|
||||||
|
$setting = Setting::first();
|
||||||
|
|
||||||
|
$pdf = Pdf::loadView('admin.koleksi.label_barcode_single', compact('koleksi', 'setting'))
|
||||||
|
->setPaper([0, 0, 200, 120], 'portrait');
|
||||||
|
|
||||||
|
return $pdf->stream("barcode_{$koleksi->kode_eksemplar}.pdf");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function printBarcodeMultiple(Request $request)
|
||||||
|
{
|
||||||
|
$selected = $request->input('selected', []);
|
||||||
|
|
||||||
|
if (!is_array($selected)) {
|
||||||
|
$selected = explode(',', $selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($selected)) {
|
||||||
|
return redirect()->back()->with('error', 'Pilih minimal satu koleksi untuk dicetak.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$koleksiList = Koleksi::whereIn('kode_eksemplar', $selected)->get();
|
||||||
|
$setting = Setting::first();
|
||||||
|
|
||||||
|
$pdf = Pdf::loadView('admin.koleksi.label_barcode_multiple', compact('koleksiList', 'setting'))
|
||||||
|
->setPaper('a4', 'portrait');
|
||||||
|
|
||||||
|
return $pdf->stream("barcode_massal.pdf");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function edit($kode_eksemplar)
|
||||||
|
{
|
||||||
|
$koleksi = Koleksi::where('kode_eksemplar', $kode_eksemplar)->firstOrFail();
|
||||||
|
$publishers = Publisher::all();
|
||||||
|
$publishPlaces = PublishPlace::all();
|
||||||
|
|
||||||
|
return view('admin.koleksi.edit', compact('koleksi', 'publishers', 'publishPlaces'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request, $kode_eksemplar)
|
||||||
|
{
|
||||||
|
$koleksi = Koleksi::where('kode_eksemplar', $kode_eksemplar)->firstOrFail();
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'title' => 'required|string|max:255',
|
||||||
|
'sor' => 'nullable|string|max:255',
|
||||||
|
'publisher_name' => 'nullable|string|max:255',
|
||||||
|
'publish_place_name' => 'nullable|string|max:255',
|
||||||
|
'publish_year' => 'nullable|integer',
|
||||||
|
'isbn_issn' => 'nullable|string|max:50',
|
||||||
|
'edition' => 'nullable|string|max:100',
|
||||||
|
'classification' => 'nullable|string|max:100',
|
||||||
|
'labels' => 'nullable|string|max:255',
|
||||||
|
'image' => 'nullable|file|mimes:jpg,jpeg,png,gif',
|
||||||
|
'opac_hide' => 'nullable|boolean',
|
||||||
|
'promoted' => 'nullable|boolean',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->hasFile('image')) {
|
||||||
|
if ($koleksi->image) {
|
||||||
|
Storage::disk('public')->delete($koleksi->image);
|
||||||
|
}
|
||||||
|
$koleksi->image = $request->file('image')->store('images', 'public');
|
||||||
|
}
|
||||||
|
|
||||||
|
$koleksi->update([
|
||||||
|
'title' => $request->title,
|
||||||
|
'sor' => $request->sor,
|
||||||
|
'publisher_name' => $request->publisher_name,
|
||||||
|
'publish_place_name' => $request->publish_place_name,
|
||||||
|
'publish_year' => $request->publish_year,
|
||||||
|
'isbn_issn' => $request->isbn_issn,
|
||||||
|
'edition' => $request->edition,
|
||||||
|
'classification' => $request->classification,
|
||||||
|
'labels' => $request->labels,
|
||||||
|
'image' => $koleksi->image,
|
||||||
|
'opac_hide' => $request->opac_hide ?? 0,
|
||||||
|
'promoted' => $request->promoted ?? 0,
|
||||||
|
'last_update' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('admin.koleksi.index')
|
||||||
|
->with('success', '✅ Data koleksi berhasil diperbarui.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function destroy($kode_eksemplar)
|
||||||
|
{
|
||||||
|
$koleksi = Koleksi::where('kode_eksemplar', $kode_eksemplar)->firstOrFail();
|
||||||
|
|
||||||
|
if ($koleksi->image) {
|
||||||
|
Storage::disk('public')->delete($koleksi->image);
|
||||||
|
}
|
||||||
|
if ($koleksi->barcode) {
|
||||||
|
Storage::disk('public')->delete($koleksi->barcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
$koleksi->delete();
|
||||||
|
|
||||||
|
return redirect()->route('admin.koleksi.index')
|
||||||
|
->with('success', '✅ Koleksi berhasil dihapus.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,240 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use App\Mail\BukuSiapDiambilMail;
|
||||||
|
use App\Mail\PeminjamanDitolakMail;
|
||||||
|
use App\Mail\BukuDikembalikanMail;
|
||||||
|
use App\Mail\PerpanjanganDisetujuiMail;
|
||||||
|
use App\Mail\PerpanjanganDitolakMail;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class PeminjamanController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$transactions = BorrowTransaction::with(['anggota', 'koleksi'])
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('admin.peminjaman', compact('transactions'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function downloadSuratPengantar($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if (!$transaction->surat_pengantar) {
|
||||||
|
return back()->with('error', 'File surat pengantar tidak tersedia.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$filePath = 'public/surat_pengantar/' . $transaction->surat_pengantar;
|
||||||
|
|
||||||
|
if (!Storage::exists($filePath)) {
|
||||||
|
return back()->with('error', 'File surat pengantar tidak ditemukan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return Storage::download($filePath, $transaction->surat_pengantar);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function kembalikan($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if (!in_array($transaction->status, ['dipinjam', 'pengembalian_menunggu'])) {
|
||||||
|
return redirect()->route('admin.peminjaman')
|
||||||
|
->with('error', 'Transaksi ini belum dipinjam atau sudah dikembalikan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction->markAsDikembalikan();
|
||||||
|
|
||||||
|
if ($transaction->anggota && $transaction->anggota->email) {
|
||||||
|
try {
|
||||||
|
Mail::to($transaction->anggota->email)->send(new BukuDikembalikanMail($transaction));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('admin.peminjaman')
|
||||||
|
->with('success', 'Buku berhasil ditandai sebagai dikembalikan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setujui(Request $request, $id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if (!in_array($transaction->status, ['menunggu', 'pending'])) {
|
||||||
|
return redirect()->back()->with('error', 'Transaksi ini sudah diproses.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'pickup_date' => 'required|date',
|
||||||
|
'pickup_time' => 'required|date_format:H:i',
|
||||||
|
'tanggal_kembali' => 'nullable|date|after_or_equal:pickup_date',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$tanggalKembali = $request->tanggal_kembali
|
||||||
|
? Carbon::parse($request->tanggal_kembali)
|
||||||
|
: Carbon::parse($request->pickup_date)->addDays(7);
|
||||||
|
|
||||||
|
$transaction->pickup_date = $request->pickup_date;
|
||||||
|
$transaction->pickup_time = $request->pickup_time;
|
||||||
|
$transaction->tanggal_kembali = $tanggalKembali;
|
||||||
|
$transaction->status = 'disetujui';
|
||||||
|
$transaction->save();
|
||||||
|
|
||||||
|
if ($transaction->anggota && $transaction->anggota->email) {
|
||||||
|
try {
|
||||||
|
Mail::to($transaction->anggota->email)
|
||||||
|
->send(new BukuSiapDiambilMail($transaction));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('admin.peminjaman')
|
||||||
|
->with('success', 'Peminjaman disetujui. Email pemberitahuan telah dikirim ke anggota.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function ambilBuku($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if ($transaction->status !== 'disetujui') {
|
||||||
|
return redirect()->route('admin.peminjaman')
|
||||||
|
->with('error', 'Buku belum disetujui atau sudah diambil.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction->markAsDipinjam();
|
||||||
|
|
||||||
|
return redirect()->route('admin.peminjaman')
|
||||||
|
->with('success', 'Buku berhasil diambil. Status transaksi: Dipinjam.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function tolak($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if (!in_array($transaction->status, ['menunggu', 'pending'])) {
|
||||||
|
return redirect()->back()->with('error', 'Transaksi ini sudah diproses.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction->markAsDitolak();
|
||||||
|
|
||||||
|
if ($transaction->anggota && $transaction->anggota->email) {
|
||||||
|
try {
|
||||||
|
Mail::to($transaction->anggota->email)
|
||||||
|
->send(new PeminjamanDitolakMail($transaction));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('admin.peminjaman')
|
||||||
|
->with('success', 'Peminjaman ditolak dan email pemberitahuan dikirim.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setujuiPengembalian($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if ($transaction->status !== 'pengembalian_menunggu') {
|
||||||
|
return back()->with('error', 'Transaksi ini tidak menunggu pengembalian.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction->markAsDikembalikan();
|
||||||
|
|
||||||
|
if ($transaction->anggota && $transaction->anggota->email) {
|
||||||
|
try {
|
||||||
|
Mail::to($transaction->anggota->email)->send(new BukuDikembalikanMail($transaction));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('admin.peminjaman')
|
||||||
|
->with('success', 'Pengembalian buku telah disetujui oleh admin.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'anggota_id' => 'required|exists:anggota,id',
|
||||||
|
'koleksi_id' => 'required|exists:koleksis,biblio_id',
|
||||||
|
'tanggal_pinjam' => 'required|date',
|
||||||
|
'surat_pengantar' => 'nullable|file|mimes:pdf|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = $request->only('anggota_id', 'koleksi_id', 'tanggal_pinjam');
|
||||||
|
|
||||||
|
if ($request->hasFile('surat_pengantar')) {
|
||||||
|
$file = $request->file('surat_pengantar');
|
||||||
|
$filename = time() . '_' . $file->getClientOriginalName();
|
||||||
|
$file->storeAs('public/surat_pengantar', $filename);
|
||||||
|
$data['surat_pengantar'] = $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['status'] = 'menunggu';
|
||||||
|
|
||||||
|
BorrowTransaction::create($data);
|
||||||
|
|
||||||
|
return redirect()->route('admin.peminjaman')
|
||||||
|
->with('success', 'Transaksi peminjaman berhasil dibuat dan menunggu persetujuan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setujuiPerpanjangan($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if ($transaction->status !== 'perpanjangan_menunggu') {
|
||||||
|
return back()->with('error', 'Transaksi ini tidak menunggu perpanjangan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction->tanggal_kembali = Carbon::parse($transaction->tanggal_kembali)->addDays(7);
|
||||||
|
$transaction->status = 'dipinjam';
|
||||||
|
$transaction->save();
|
||||||
|
|
||||||
|
if ($transaction->anggota && $transaction->anggota->email) {
|
||||||
|
try {
|
||||||
|
Mail::to($transaction->anggota->email)
|
||||||
|
->send(new PerpanjanganDisetujuiMail($transaction));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return back()->with('success', 'Perpanjangan disetujui dan email telah dikirim ke anggota.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tolakPerpanjangan($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if ($transaction->status !== 'perpanjangan_menunggu') {
|
||||||
|
return back()->with('error', 'Transaksi ini tidak menunggu perpanjangan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction->status = 'dipinjam';
|
||||||
|
$transaction->save();
|
||||||
|
|
||||||
|
if ($transaction->anggota && $transaction->anggota->email) {
|
||||||
|
try {
|
||||||
|
Mail::to($transaction->anggota->email)
|
||||||
|
->send(new PerpanjanganDitolakMail($transaction));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return back()->with('success', 'Perpanjangan ditolak dan email pemberitahuan telah dikirim.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Koleksi;
|
||||||
|
use App\Models\Member;
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class StatistikController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$totalBuku = Koleksi::count('kode_eksemplar');
|
||||||
|
$totalAnggota = Member::count();
|
||||||
|
$totalPeminjaman = BorrowTransaction::where('status', 'dipinjam')->count();
|
||||||
|
$totalPengembalian = BorrowTransaction::where('status', 'dikembalikan')->count();
|
||||||
|
|
||||||
|
$peminjamanPerBulan = BorrowTransaction::selectRaw('MONTH(tanggal_pinjam) as bulan, COUNT(*) as total')
|
||||||
|
->groupBy('bulan')
|
||||||
|
->orderBy('bulan')
|
||||||
|
->pluck('total', 'bulan');
|
||||||
|
|
||||||
|
$bulanLabels = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agu', 'Sep', 'Okt', 'Nov', 'Des'];
|
||||||
|
$dataPeminjaman = [];
|
||||||
|
|
||||||
|
for ($i = 1; $i <= 12; $i++) {
|
||||||
|
$dataPeminjaman[] = $peminjamanPerBulan[$i] ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('admin.statistik', compact(
|
||||||
|
'totalBuku',
|
||||||
|
'totalAnggota',
|
||||||
|
'totalPeminjaman',
|
||||||
|
'totalPengembalian',
|
||||||
|
'bulanLabels',
|
||||||
|
'dataPeminjaman'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class SystemController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (!Auth::check() || Auth::user()->role !== 'admin') {
|
||||||
|
abort(403, 'Akses ditolak. Hanya admin yang dapat membuka halaman ini.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$users = User::orderBy('name')->get();
|
||||||
|
return view('admin.system', compact('users'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function makeAdmin(Request $request)
|
||||||
|
{
|
||||||
|
if (!Auth::check() || Auth::user()->role !== 'admin') {
|
||||||
|
abort(403, 'Akses ditolak.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate(['user_id' => 'required|exists:users,id']);
|
||||||
|
$user = User::findOrFail($request->user_id);
|
||||||
|
|
||||||
|
$user->role = 'admin';
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
return back()->with('success', "{$user->name} sekarang menjadi admin.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function removeAdmin(Request $request)
|
||||||
|
{
|
||||||
|
if (!Auth::check() || Auth::user()->role !== 'admin') {
|
||||||
|
abort(403, 'Akses ditolak.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate(['user_id' => 'required|exists:users,id']);
|
||||||
|
$user = User::findOrFail($request->user_id);
|
||||||
|
|
||||||
|
if ($user->id === Auth::id()) {
|
||||||
|
return back()->with('error', 'Anda tidak dapat mencabut status admin Anda sendiri.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->role = 'user';
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
return back()->with('success', "Status admin untuk {$user->name} telah dicabut.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function block(Request $request)
|
||||||
|
{
|
||||||
|
if (!Auth::check() || Auth::user()->role !== 'admin') {
|
||||||
|
abort(403, 'Akses ditolak.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate(['user_id' => 'required|exists:users,id']);
|
||||||
|
|
||||||
|
$user = User::find($request->user_id);
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return back()->with('error', 'User tidak ditemukan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->role === 'admin') {
|
||||||
|
return back()->with('error', 'Tidak dapat memblokir admin.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->blocked_at = now();
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
return back()->with('success', "User {$user->name} telah diblokir.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function unblock(Request $request)
|
||||||
|
{
|
||||||
|
if (!Auth::check() || Auth::user()->role !== 'admin') {
|
||||||
|
abort(403, 'Akses ditolak.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate(['user_id' => 'required|exists:users,id']);
|
||||||
|
|
||||||
|
$user = User::find($request->user_id);
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return back()->with('error', 'User tidak ditemukan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->blocked_at = null;
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
return back()->with('success', "Blokir untuk {$user->name} telah dibuka.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class AdminController extends Controller
|
||||||
|
{
|
||||||
|
public function dashboard() {
|
||||||
|
$totalBuku = 1250;
|
||||||
|
return view('admin.dashboard', compact('totalBuku'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function laporan() { return view('admin.laporan'); }
|
||||||
|
public function koleksi() { return view('admin.koleksi'); }
|
||||||
|
public function anggota() { return view('admin.anggota'); }
|
||||||
|
public function sirkulasi() { return view('admin.sirkulasi'); }
|
||||||
|
public function settings() { return view('admin.settings'); }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Laravel\Socialite\Facades\Socialite;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class GoogleController extends Controller
|
||||||
|
{
|
||||||
|
public function redirectToGoogle()
|
||||||
|
{
|
||||||
|
return Socialite::driver('google')->redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handleGoogleCallback()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$googleUser = Socialite::driver('google')->stateless()->user();
|
||||||
|
|
||||||
|
$user = User::where('email', $googleUser->getEmail())->first();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
$user = User::create([
|
||||||
|
'name' => $googleUser->getName(),
|
||||||
|
'email' => $googleUser->getEmail(),
|
||||||
|
'password' => bcrypt(uniqid()),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Auth::login($user);
|
||||||
|
|
||||||
|
return redirect()->route('home');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return redirect()->route('login')->with('error', 'Login Google gagal!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use App\Models\User;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class LoginWithEmailController extends Controller
|
||||||
|
{
|
||||||
|
public function showForm() {
|
||||||
|
return view('auth.login-email');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendLink(Request $request) {
|
||||||
|
$request->validate(['email' => 'required|email|exists:users,email']);
|
||||||
|
$user = User::where('email', $request->email)->first();
|
||||||
|
|
||||||
|
$token = Str::random(64);
|
||||||
|
$user->email_login_token = $token;
|
||||||
|
$user->token_expires_at = Carbon::now()->addMinutes(15);
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
$link = route('login.email.token', $token);
|
||||||
|
Mail::raw("Klik link ini untuk login: $link", function($message) use($user) {
|
||||||
|
$message->to($user->email)
|
||||||
|
->subject('Link Login Sekali Pakai');
|
||||||
|
});
|
||||||
|
|
||||||
|
return back()->with('success', 'Link login sudah dikirim ke email Anda.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function login($token) {
|
||||||
|
$user = User::where('email_login_token', $token)
|
||||||
|
->where('token_expires_at', '>', Carbon::now())
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
|
Auth::login($user);
|
||||||
|
|
||||||
|
$user->email_login_token = null;
|
||||||
|
$user->token_expires_at = null;
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
return redirect()->route('dashboard');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class OtpVerificationController extends Controller
|
||||||
|
{
|
||||||
|
public function showForm(Request $request)
|
||||||
|
{
|
||||||
|
$email = session('email');
|
||||||
|
if (!$email) {
|
||||||
|
return redirect()->route('register')->with('error', 'Email tidak ditemukan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('auth.verify-otp', compact('email'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verify(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'email' => 'required|email',
|
||||||
|
'otp' => 'required|digits:6',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::where('email', $request->email)
|
||||||
|
->where('email_otp', $request->otp)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return back()->with('error', 'Kode OTP salah atau tidak valid.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->email_verified_at = now();
|
||||||
|
$user->email_otp = null;
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
return redirect()->route('login')->with('success', 'Email berhasil diverifikasi! Silakan login.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Validation\Rules\Password;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use App\Mail\VerifyEmail;
|
||||||
|
|
||||||
|
class RegisterController extends Controller
|
||||||
|
{
|
||||||
|
public function showRegistrationForm()
|
||||||
|
{
|
||||||
|
return view('auth.register');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function register(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => ['required', 'string', 'max:255'],
|
||||||
|
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||||
|
'password' => ['required', 'confirmed', Password::min(8)],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::create([
|
||||||
|
'name' => $request->name,
|
||||||
|
'email' => $request->email,
|
||||||
|
'password' => $request->password,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Kirim email verifikasi
|
||||||
|
$user->sendEmailVerificationNotification();
|
||||||
|
|
||||||
|
return redirect()->route('verification.notice');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class VerificationController extends Controller
|
||||||
|
{
|
||||||
|
public function verify($token)
|
||||||
|
{
|
||||||
|
$user = User::where('verification_token', $token)->first();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return redirect()->route('login')->with('error', 'Token verifikasi tidak valid.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->email_verified_at = now();
|
||||||
|
$user->verification_token = null;
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
return redirect()->route('login')->with('success', 'Email berhasil diverifikasi. Silakan login.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,390 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Illuminate\Support\Facades\Password;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Koleksi;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class AuthController extends Controller
|
||||||
|
{
|
||||||
|
public function showRegister()
|
||||||
|
{
|
||||||
|
if (Auth::check()) {
|
||||||
|
return $this->redirectBasedOnRole();
|
||||||
|
}
|
||||||
|
return view('register');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showLogin()
|
||||||
|
{
|
||||||
|
if (Auth::check()) {
|
||||||
|
return $this->redirectBasedOnRole();
|
||||||
|
}
|
||||||
|
return view('login');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function register(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'email' => 'required|email|unique:users,email',
|
||||||
|
'password' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'min:8',
|
||||||
|
'regex:/[A-Z]/',
|
||||||
|
'regex:/[a-z]/',
|
||||||
|
'regex:/[0-9]/',
|
||||||
|
'regex:/[.,]/',
|
||||||
|
'confirmed',
|
||||||
|
],
|
||||||
|
], [
|
||||||
|
'password.min' => 'Kata sandi minimal 8 karakter.',
|
||||||
|
'password.regex' => 'Kata sandi harus mengandung huruf besar, huruf kecil, angka, dan tanda baca (.,)',
|
||||||
|
'password.confirmed' => 'Konfirmasi kata sandi tidak cocok.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$otp = rand(100000, 999999);
|
||||||
|
$expiresAt = now()->addMinute();
|
||||||
|
|
||||||
|
$user = User::create([
|
||||||
|
'name' => $request->name,
|
||||||
|
'email' => $request->email,
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
'role' => 'user',
|
||||||
|
'email_otp' => $otp,
|
||||||
|
'email_otp_expires_at' => $expiresAt,
|
||||||
|
'otp_last_sent_at' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->sendOtpEmail($user, $otp);
|
||||||
|
|
||||||
|
return redirect()->route('verify.email.form', ['email' => $user->email])
|
||||||
|
->with('success', 'Registrasi berhasil! Silakan cek email untuk kode verifikasi (berlaku 1 menit).');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function login(Request $request)
|
||||||
|
{
|
||||||
|
$credentials = $request->validate([
|
||||||
|
'email' => 'required|email',
|
||||||
|
'password' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::where('email', $request->email)->first();
|
||||||
|
|
||||||
|
if ($user && $user->blocked_at !== null) {
|
||||||
|
return back()->withErrors([
|
||||||
|
'email' => 'Akun Anda telah diblokir dan tidak dapat login.'
|
||||||
|
])->onlyInput('email');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user && !$user->email_verified_at) {
|
||||||
|
return back()->withErrors(['email' => 'Email belum diverifikasi. Silakan verifikasi terlebih dahulu.'])
|
||||||
|
->onlyInput('email');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Auth::attempt($credentials)) {
|
||||||
|
$request->session()->regenerate();
|
||||||
|
return $this->redirectBasedOnRole();
|
||||||
|
}
|
||||||
|
|
||||||
|
return back()->withErrors(['email' => 'Email atau password salah!'])->onlyInput('email');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logout(Request $request)
|
||||||
|
{
|
||||||
|
Auth::logout();
|
||||||
|
$request->session()->invalidate();
|
||||||
|
$request->session()->regenerateToken();
|
||||||
|
return redirect()->route('login');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function dashboard()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!$user) return redirect()->route('login');
|
||||||
|
|
||||||
|
if ($user->role === 'admin') return redirect()->route('admin.dashboard');
|
||||||
|
if ($user->role === 'user') return redirect()->route('user.dashboard');
|
||||||
|
abort(403, 'Akses ditolak!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function adminDashboard()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!$user || $user->role !== 'admin') return redirect()->route('login');
|
||||||
|
return view('admin.dashboard', compact('user'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function userDashboard()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!$user || $user->role !== 'user') return redirect()->route('login');
|
||||||
|
return view('user.dashboard', compact('user'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function profile()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!$user) return redirect()->route('login');
|
||||||
|
return $user->role === 'admin'
|
||||||
|
? view('admin.profile', compact('user'))
|
||||||
|
: view('user.profile', compact('user'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function security()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!$user || $user->role !== 'user') return redirect()->route('login');
|
||||||
|
return view('user.security', compact('user'));
|
||||||
|
}
|
||||||
|
public function adminSecurity()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!$user || $user->role !== 'admin') return redirect()->route('login');
|
||||||
|
return view('admin.security', compact('user'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function updateProfile(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'email' => 'required|email|max:255|unique:users,email,' . Auth::id(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = Auth::user();
|
||||||
|
$user->name = $request->name;
|
||||||
|
$user->email = $request->email;
|
||||||
|
|
||||||
|
if ($request->filled('new_password')) {
|
||||||
|
$request->validate([
|
||||||
|
'current_password' => 'required',
|
||||||
|
'new_password' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'min:8',
|
||||||
|
'regex:/[A-Z]/',
|
||||||
|
'regex:/[a-z]/',
|
||||||
|
'regex:/[0-9]/',
|
||||||
|
'regex:/[.,]/',
|
||||||
|
'confirmed',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!Hash::check($request->current_password, $user->password)) {
|
||||||
|
return back()->withErrors(['current_password' => 'Password saat ini salah']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->password = Hash::make($request->new_password);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->save();
|
||||||
|
return redirect()->route('user.security')->with('success', 'Profil & password berhasil diperbarui!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function userKoleksi()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!$user || $user->role !== 'user') return redirect()->route('login');
|
||||||
|
|
||||||
|
$koleksi = Koleksi::where('user_id', $user->id)->get();
|
||||||
|
return view('user.koleksi', compact('user', 'koleksi'));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function redirectBasedOnRole()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!$user) return redirect()->route('login');
|
||||||
|
return $user->role === 'admin'
|
||||||
|
? redirect()->route('admin.dashboard')
|
||||||
|
: redirect()->route('user.dashboard');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showVerifyEmailForm(Request $request)
|
||||||
|
{
|
||||||
|
$email = $request->query('email');
|
||||||
|
return view('verify-email', compact('email'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verifyEmail(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'email' => 'required|email',
|
||||||
|
'otp' => 'required|digits:6',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::where('email', $request->email)
|
||||||
|
->where('email_otp', $request->otp)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return back()->withErrors(['otp' => 'Kode verifikasi salah.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->email_otp_expires_at && now()->greaterThan($user->email_otp_expires_at)) {
|
||||||
|
$user->otp_last_sent_at = null;
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
return back()->withErrors(['otp' => 'Kode OTP sudah kadaluarsa. Silakan kirim ulang.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->update([
|
||||||
|
'email_verified_at' => now(),
|
||||||
|
'email_otp' => null,
|
||||||
|
'email_otp_expires_at' => null,
|
||||||
|
'otp_last_sent_at' => null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('login')->with('success', 'Email berhasil diverifikasi! Silakan login.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resendOtp(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate(['email' => 'required|email']);
|
||||||
|
$user = User::where('email', $request->email)->first();
|
||||||
|
|
||||||
|
if (!$user) return back()->withErrors(['email' => 'Email tidak ditemukan.']);
|
||||||
|
|
||||||
|
if ($user->email_otp_expires_at && now()->greaterThan($user->email_otp_expires_at)) {
|
||||||
|
$user->otp_last_sent_at = null;
|
||||||
|
$user->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($user->otp_last_sent_at)) {
|
||||||
|
return $this->sendNewOtp($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
$lastSent = Carbon::parse($user->otp_last_sent_at);
|
||||||
|
$diff = now()->diffInSeconds($lastSent);
|
||||||
|
|
||||||
|
if ($diff < 60) {
|
||||||
|
$remaining = 60 - $diff;
|
||||||
|
return back()->withErrors(['otp' => "Silakan tunggu {$remaining} detik sebelum kirim ulang OTP."]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->sendNewOtp($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function sendNewOtp($user)
|
||||||
|
{
|
||||||
|
$otp = rand(100000, 999999);
|
||||||
|
|
||||||
|
$user->update([
|
||||||
|
'email_otp' => $otp,
|
||||||
|
'email_otp_expires_at' => now()->addMinute(),
|
||||||
|
'otp_last_sent_at' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->sendOtpEmail($user, $otp);
|
||||||
|
return back()->with('success', 'Kode OTP baru telah dikirim ke email Anda. Berlaku 1 menit.');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function sendOtpEmail($user, $otp)
|
||||||
|
{
|
||||||
|
Mail::raw(
|
||||||
|
"Halo {$user->name},\n\nKode verifikasi akun Anda adalah: {$otp}\nKode ini berlaku selama 1 menit.\n\nTerima kasih,\nBakorwil III Malang",
|
||||||
|
function ($message) use ($user) {
|
||||||
|
$message->to($user->email)
|
||||||
|
->subject('Kode Verifikasi Akun Anda - Bakorwil III Malang');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showForgotPasswordForm()
|
||||||
|
{
|
||||||
|
return view('auth.forgot-password');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendResetLink(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate(['email' => 'required|email']);
|
||||||
|
$status = Password::sendResetLink($request->only('email'));
|
||||||
|
|
||||||
|
return $status === Password::RESET_LINK_SENT
|
||||||
|
? back()->with(['success' => __($status)])
|
||||||
|
: back()->withErrors(['email' => __($status)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showResetPasswordForm($token)
|
||||||
|
{
|
||||||
|
return view('auth.reset-password', ['token' => $token]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resetPassword(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'token' => 'required',
|
||||||
|
'email' => 'required|email',
|
||||||
|
'password' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'min:8',
|
||||||
|
'regex:/[A-Z]/',
|
||||||
|
'regex:/[a-z]/',
|
||||||
|
'regex:/[0-9]/',
|
||||||
|
'regex:/[.,]/',
|
||||||
|
'confirmed',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$status = Password::reset(
|
||||||
|
$request->only('email', 'password', 'password_confirmation', 'token'),
|
||||||
|
function ($user, $password) {
|
||||||
|
$user->forceFill([
|
||||||
|
'password' => Hash::make($password),
|
||||||
|
])->save();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $status === Password::PASSWORD_RESET
|
||||||
|
? redirect()->route('login')->with('success', __($status))
|
||||||
|
: back()->withErrors(['email' => [__($status)]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateFoto(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'foto' => 'required|image|mimes:jpeg,png,jpg|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if ($request->hasFile('foto')) {
|
||||||
|
|
||||||
|
if ($user->foto && file_exists(public_path('storage/foto/'.$user->foto))) {
|
||||||
|
unlink(public_path('storage/foto/'.$user->foto));
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $request->file('foto');
|
||||||
|
$namaFile = time() . '_' . $file->getClientOriginalName();
|
||||||
|
$file->move(public_path('storage/foto'), $namaFile);
|
||||||
|
|
||||||
|
$user->foto = $namaFile;
|
||||||
|
$user->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return back()->with('success', 'Foto profil berhasil diperbarui!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteFoto()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if ($user->foto && file_exists(public_path('storage/foto/'.$user->foto))) {
|
||||||
|
unlink(public_path('storage/foto/'.$user->foto));
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->foto = null;
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
return back()->with('success', 'Foto profil berhasil dihapus!');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
use App\Models\Anggota;
|
||||||
|
use App\Models\Koleksi;
|
||||||
|
|
||||||
|
class BorrowTransactionController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$transactions = BorrowTransaction::with(['anggota', 'koleksi'])
|
||||||
|
->orderBy('tanggal_pinjam', 'desc')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('dashboard.sirkulasi.index', compact('transactions'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$anggota = Anggota::all();
|
||||||
|
$koleksi = Koleksi::available()->get();
|
||||||
|
|
||||||
|
return view('dashboard.sirkulasi.create', compact('anggota', 'koleksi'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'anggota_id' => 'required|exists:anggota,id',
|
||||||
|
'koleksi_id' => 'required|exists:koleksis,biblio_id',
|
||||||
|
'tanggal_pinjam' => 'required|date',
|
||||||
|
'tanggal_kembali' => 'nullable|date|after_or_equal:tanggal_pinjam',
|
||||||
|
'surat_pengantar' => 'nullable|mimes:pdf|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$alreadyBorrowed = BorrowTransaction::where('koleksi_id', $request->koleksi_id)
|
||||||
|
->where('status', 'dipinjam')
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if ($alreadyBorrowed) {
|
||||||
|
return redirect()->back()->withErrors(['koleksi_id' => 'Buku ini sedang dipinjam.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$fileName = null;
|
||||||
|
if ($request->hasFile('surat_pengantar')) {
|
||||||
|
$file = $request->file('surat_pengantar');
|
||||||
|
$fileName = time() . '_' . $file->getClientOriginalName();
|
||||||
|
$file->storeAs('public/surat_pengantar', $fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
BorrowTransaction::create([
|
||||||
|
'anggota_id' => $request->anggota_id,
|
||||||
|
'koleksi_id' => $request->koleksi_id,
|
||||||
|
'tanggal_pinjam' => $request->tanggal_pinjam,
|
||||||
|
'tanggal_kembali' => $request->tanggal_kembali,
|
||||||
|
'status' => 'dipinjam',
|
||||||
|
'surat_pengantar' => $fileName,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('dashboard.sirkulasi.index')
|
||||||
|
->with('success', 'Transaksi peminjaman berhasil disimpan!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function kembalikan($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if ($transaction->status != 'dipinjam') {
|
||||||
|
return redirect()->route('dashboard.sirkulasi.index')
|
||||||
|
->with('error', 'Transaksi ini sudah dikembalikan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction->update([
|
||||||
|
'status' => 'dikembalikan',
|
||||||
|
'tanggal_kembali' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('dashboard.sirkulasi.index')
|
||||||
|
->with('success', 'Buku berhasil dikembalikan!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
|
||||||
|
class Controller extends BaseController
|
||||||
|
{
|
||||||
|
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Koleksi;
|
||||||
|
use App\Models\Anggota;
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class DashboardController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$totalBuku = Koleksi::count();
|
||||||
|
$totalAnggota = Anggota::count();
|
||||||
|
|
||||||
|
$peminjamanAktif = BorrowTransaction::whereNull('tanggal_kembali')->count();
|
||||||
|
$pengembalian = BorrowTransaction::whereNotNull('tanggal_kembali')
|
||||||
|
->whereBetween('tanggal_kembali', [Carbon::now()->startOfWeek(), Carbon::now()->endOfWeek()])
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$bulan = ['Jun','Jul','Agt','Sep','Okt','Nov','Des'];
|
||||||
|
$jumlahTransaksi = [];
|
||||||
|
foreach($bulan as $bln){
|
||||||
|
$count = BorrowTransaction::whereMonth('created_at', date('m', strtotime($bln.' 1')))->count();
|
||||||
|
$jumlahTransaksi[] = $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard.index', compact(
|
||||||
|
'totalBuku',
|
||||||
|
'totalAnggota',
|
||||||
|
'peminjamanAktif',
|
||||||
|
'pengembalian',
|
||||||
|
'bulan',
|
||||||
|
'jumlahTransaksi'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Koleksi;
|
||||||
|
|
||||||
|
class HomeController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$jilid = Koleksi::count();
|
||||||
|
$eksemplar = Koleksi::count();
|
||||||
|
return view('home'); // Akan memanggil resources/views/home.blade.php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,217 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\User;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Koleksi;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Intervention\Image\Facades\Image;
|
||||||
|
|
||||||
|
class KoleksiController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$query = Koleksi::with('borrowTransactions');
|
||||||
|
|
||||||
|
|
||||||
|
if ($request->filled('search')) {
|
||||||
|
$kategori = $request->input('kategori');
|
||||||
|
$search = $request->input('search');
|
||||||
|
|
||||||
|
switch ($kategori) {
|
||||||
|
case 'judul':
|
||||||
|
$query->where('title', 'like', "%{$search}%");
|
||||||
|
break;
|
||||||
|
case 'pengarang':
|
||||||
|
$query->where('sor', 'like', "%{$search}%");
|
||||||
|
break;
|
||||||
|
case 'isbn':
|
||||||
|
$query->where(function ($q) use ($search) {
|
||||||
|
$q->where('isbn_issn', 'like', "%{$search}%")
|
||||||
|
->orWhere('kode_eksemplar', 'like', "%{$search}%");
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$query->where(function ($q) use ($search) {
|
||||||
|
$q->where('title', 'like', "%{$search}%")
|
||||||
|
->orWhere('sor', 'like', "%{$search}%")
|
||||||
|
->orWhere('isbn_issn', 'like', "%{$search}%")
|
||||||
|
->orWhere('kode_eksemplar', 'like', "%{$search}%");
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($request->filled('tipe')) {
|
||||||
|
$query->where('tipe', $request->input('tipe'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->filled('bahasa')) {
|
||||||
|
$query->where('bahasa', $request->input('bahasa'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->filled('subjek')) {
|
||||||
|
$query->where('subjek', $request->input('subjek'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->filled('tahun_min')) {
|
||||||
|
$query->where('publish_year', '>=', $request->input('tahun_min'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->filled('tahun_max')) {
|
||||||
|
$query->where('publish_year', '<=', $request->input('tahun_max'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->filled('lokasi')) {
|
||||||
|
$query->where('lokasi', $request->input('lokasi'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($request->filled('status')) {
|
||||||
|
$status = $request->input('status');
|
||||||
|
|
||||||
|
if ($status === 'tersedia') {
|
||||||
|
$query->whereDoesntHave('borrowTransactions', function ($q) {
|
||||||
|
$q->whereIn('status', [
|
||||||
|
'menunggu',
|
||||||
|
'disetujui',
|
||||||
|
'dipinjam',
|
||||||
|
'pengembalian_menunggu'
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
} elseif ($status === 'dipinjam') {
|
||||||
|
$query->whereHas('borrowTransactions', function ($q) {
|
||||||
|
$q->whereIn('status', [
|
||||||
|
'menunggu',
|
||||||
|
'disetujui',
|
||||||
|
'dipinjam',
|
||||||
|
'pengembalian_menunggu'
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$koleksi = $query->orderBy('input_date', 'desc')
|
||||||
|
->paginate(10)
|
||||||
|
->withQueryString();
|
||||||
|
|
||||||
|
$jumlahJilid = Koleksi::count();
|
||||||
|
|
||||||
|
return view('user.koleksi', compact('koleksi', 'jumlahJilid'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(Koleksi $koleksi)
|
||||||
|
{
|
||||||
|
return view('user.koleksi.show', compact('koleksi'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => 'required|string|max:255',
|
||||||
|
'sor' => 'nullable|string|max:255',
|
||||||
|
'publisher_id' => 'nullable|string|max:255',
|
||||||
|
'publish_place_id' => 'nullable|string|max:255',
|
||||||
|
'publish_year' => 'nullable|integer',
|
||||||
|
'kode_eksemplar' => 'nullable|string|max:100',
|
||||||
|
'tipe' => 'nullable|string|max:100',
|
||||||
|
'bahasa' => 'nullable|string|max:100',
|
||||||
|
'subjek' => 'nullable|string|max:100',
|
||||||
|
'lokasi' => 'nullable|string|max:100',
|
||||||
|
'isbn_issn' => 'nullable|string|max:100',
|
||||||
|
'image' => 'nullable|image|mimes:jpg,jpeg,png|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->hasFile('image')) {
|
||||||
|
$file = $request->file('image');
|
||||||
|
$filename = time() . '_' . $file->getClientOriginalName();
|
||||||
|
$path = storage_path('app/public/image/' . $filename);
|
||||||
|
|
||||||
|
Image::make($file)
|
||||||
|
->resize(300, null, function ($constraint) {
|
||||||
|
$constraint->aspectRatio();
|
||||||
|
})
|
||||||
|
->save($path);
|
||||||
|
|
||||||
|
$validated['image'] = 'image/' . $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
Koleksi::create($validated);
|
||||||
|
|
||||||
|
return redirect()->route('user.koleksi')
|
||||||
|
->with('success', 'Data buku berhasil ditambahkan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$koleksi = Koleksi::findOrFail($id);
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => 'required|string|max:255',
|
||||||
|
'sor' => 'nullable|string|max:255',
|
||||||
|
'publisher_id' => 'nullable|string|max:255',
|
||||||
|
'publish_place_id' => 'nullable|string|max:255',
|
||||||
|
'publish_year' => 'nullable|integer',
|
||||||
|
'kode_eksemplar' => 'nullable|string|max:100',
|
||||||
|
'tipe' => 'nullable|string|max:100',
|
||||||
|
'bahasa' => 'nullable|string|max:100',
|
||||||
|
'subjek' => 'nullable|string|max:100',
|
||||||
|
'lokasi' => 'nullable|string|max:100',
|
||||||
|
'isbn_issn' => 'nullable|string|max:100',
|
||||||
|
'image' => 'nullable|image|mimes:jpg,jpeg,png|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->hasFile('image')) {
|
||||||
|
if ($koleksi->image && Storage::exists('public/' . $koleksi->image)) {
|
||||||
|
Storage::delete('public/' . $koleksi->image);
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $request->file('image');
|
||||||
|
$filename = time() . '_' . $file->getClientOriginalName();
|
||||||
|
$path = storage_path('app/public/image/' . $filename);
|
||||||
|
|
||||||
|
Image::make($file)
|
||||||
|
->resize(300, null, function ($constraint) {
|
||||||
|
$constraint->aspectRatio();
|
||||||
|
})
|
||||||
|
->save($path);
|
||||||
|
|
||||||
|
$validated['image'] = 'image/' . $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
$koleksi->update($validated);
|
||||||
|
|
||||||
|
return redirect()->route('user.koleksi')
|
||||||
|
->with('success', 'Data buku berhasil diperbarui.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function homepage()
|
||||||
|
{
|
||||||
|
$jumlahJilid = Koleksi::count('title');
|
||||||
|
return view('home', compact('jumlahJilid'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getPengarang(Request $request)
|
||||||
|
{
|
||||||
|
$judul = $request->query('judul');
|
||||||
|
|
||||||
|
if (!$judul) {
|
||||||
|
return response()->json(['pengarang' => '']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$buku = Koleksi::where('title', 'like', '%' . $judul . '%')->first();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'pengarang' => $buku->sor ?? ''
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\User;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class SecurityController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
// Bisa return view
|
||||||
|
return view('user.keamanan.security'); // Pastikan view ini dibuat
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\User;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\UserLogin;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class UserController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Halaman keamanan: menampilkan riwayat login user
|
||||||
|
*/
|
||||||
|
public function security(Request $request)
|
||||||
|
{
|
||||||
|
// Ambil user yang login saat ini
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
// Ambil login history user, terbaru terlebih dahulu, dengan pagination
|
||||||
|
$logins = UserLogin::where('user_id', $user->id)
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->paginate(10); // 10 record per halaman
|
||||||
|
|
||||||
|
// Tambahkan info tambahan jika perlu
|
||||||
|
// Contoh: total login, terakhir login
|
||||||
|
$totalLogins = UserLogin::where('user_id', $user->id)->count();
|
||||||
|
$lastLogin = UserLogin::where('user_id', $user->id)
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
// Kirim data ke view
|
||||||
|
return view('user.keamanan.security', compact('logins', 'totalLogins', 'lastLogin'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\User;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Anggota;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use App\Mail\AnggotaBaruMenungguPersetujuan;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class UserMemberController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('user.member.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'nama' => 'required|string|max:255',
|
||||||
|
'nip_nim' => 'required|string|max:255|unique:anggota,nip_nim',
|
||||||
|
'email' => 'required|email|unique:anggota,email',
|
||||||
|
'alamat' => 'required|string',
|
||||||
|
'no_hp' => 'nullable|string|max:20',
|
||||||
|
'foto' => 'nullable|image|mimes:jpg,jpeg,png|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (Auth::user()->anggota) {
|
||||||
|
return redirect()->route('user.peminjaman.create')
|
||||||
|
->with('info', 'Kamu sudah terdaftar sebagai anggota.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$namaFoto = null;
|
||||||
|
|
||||||
|
if ($request->hasFile('foto')) {
|
||||||
|
$file = $request->file('foto');
|
||||||
|
$namaFoto = time() . '_' . $file->getClientOriginalName();
|
||||||
|
|
||||||
|
$folderPath = storage_path('app/public/foto_anggota');
|
||||||
|
if (!file_exists($folderPath)) {
|
||||||
|
mkdir($folderPath, 0777, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$file->move($folderPath, $namaFoto);
|
||||||
|
|
||||||
|
if (!file_exists($folderPath . '/' . $namaFoto)) {
|
||||||
|
return back()->with('error', 'Foto gagal diupload.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$anggota = Anggota::create([
|
||||||
|
'nama' => $request->nama,
|
||||||
|
'nip_nim' => $request->nip_nim,
|
||||||
|
'email' => $request->email,
|
||||||
|
'alamat' => $request->alamat,
|
||||||
|
'no_hp' => $request->no_hp ?? null,
|
||||||
|
'user_id' => Auth::id(),
|
||||||
|
'status' => 'menunggu',
|
||||||
|
'foto' => $namaFoto,
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Mail::to('admin@bakorwil.com')->send(new AnggotaBaruMenungguPersetujuan($anggota));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
\Log::error('Gagal mengirim email ke admin: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
Auth::user()->setRelation('anggota', $anggota);
|
||||||
|
|
||||||
|
return redirect()->route('user.peminjaman.create')
|
||||||
|
->with('success', 'Data anggota berhasil dikirim. Mohon tunggu persetujuan admin.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$anggota = Anggota::latest()->take(5)->get();
|
||||||
|
return view('user.member.index', compact('anggota'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function all()
|
||||||
|
{
|
||||||
|
$anggota = Anggota::latest()->get();
|
||||||
|
return view('user.member.all', compact('anggota'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function getFotoUrl($anggota)
|
||||||
|
{
|
||||||
|
if ($anggota->foto && file_exists(storage_path('app/public/foto_anggota/'.$anggota->foto))) {
|
||||||
|
return asset('storage/foto_anggota/'.$anggota->foto);
|
||||||
|
}
|
||||||
|
return asset('images/default-user.png');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,297 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\User;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
use App\Models\Koleksi;
|
||||||
|
use App\Models\Rating;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use App\Mail\PengembalianMenungguApproval;
|
||||||
|
use App\Mail\PerpanjanganMenungguApproval;
|
||||||
|
use App\Mail\PeringatanKeterlambatanMail;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class UserPeminjamanController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$anggota = Auth::user()->anggota;
|
||||||
|
|
||||||
|
if (!$anggota) {
|
||||||
|
return redirect()->route('user.member.create')
|
||||||
|
->with('error', 'Silakan daftar anggota terlebih dahulu sebelum meminjam buku.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$dipinjam = BorrowTransaction::where('anggota_id', $anggota->id)
|
||||||
|
->where('status', 'dipinjam')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
foreach ($dipinjam as $trx) {
|
||||||
|
if ($trx->tanggal_kembali && Carbon::now()->gt(Carbon::parse($trx->tanggal_kembali))) {
|
||||||
|
|
||||||
|
if ($trx->is_late == 0) {
|
||||||
|
$trx->is_late = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trx->late_notified == 0 && env('MAIL_USERNAME')) {
|
||||||
|
try {
|
||||||
|
Mail::to($trx->anggota->email)
|
||||||
|
->send(new PeringatanKeterlambatanMail($trx));
|
||||||
|
|
||||||
|
$trx->late_notified = 1;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
\Log::error('Gagal mengirim email keterlambatan: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$trx->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$peminjaman = BorrowTransaction::with(['koleksi'])
|
||||||
|
->where('anggota_id', $anggota->id)
|
||||||
|
->orderBy('tanggal_pinjam', 'desc')
|
||||||
|
->get()
|
||||||
|
->map(function ($item) {
|
||||||
|
if ($item->pickup_date) {
|
||||||
|
$item->pickup_date = Carbon::parse($item->pickup_date)->setTimezone('Asia/Jakarta');
|
||||||
|
}
|
||||||
|
if ($item->tanggal_pinjam) {
|
||||||
|
$item->tanggal_pinjam = Carbon::parse($item->tanggal_pinjam)->setTimezone('Asia/Jakarta');
|
||||||
|
}
|
||||||
|
if ($item->tanggal_kembali) {
|
||||||
|
$item->tanggal_kembali = Carbon::parse($item->tanggal_kembali)->setTimezone('Asia/Jakarta');
|
||||||
|
}
|
||||||
|
return $item;
|
||||||
|
});
|
||||||
|
|
||||||
|
return view('user.peminjaman.index', compact('peminjaman', 'anggota'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$anggota = Auth::user()->anggota;
|
||||||
|
|
||||||
|
if (!$anggota) {
|
||||||
|
return redirect()->route('user.member.create')
|
||||||
|
->with('error', 'Silakan daftar anggota terlebih dahulu sebelum meminjam buku.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$koleksi = Koleksi::whereDoesntHave('borrowTransactions', function ($q) {
|
||||||
|
$q->whereIn('status', ['dipinjam', 'menunggu', 'disetujui']);
|
||||||
|
})->get();
|
||||||
|
|
||||||
|
$lastTransaction = $anggota->borrowTransactions()->latest()->first();
|
||||||
|
|
||||||
|
return view('user.peminjaman.create', compact('anggota', 'koleksi', 'lastTransaction'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$anggota = Auth::user()->anggota;
|
||||||
|
|
||||||
|
if (!$anggota) {
|
||||||
|
return redirect()->route('user.member.create')
|
||||||
|
->with('error', 'Silakan daftar anggota terlebih dahulu sebelum meminjam buku.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($anggota->status !== 'disetujui') {
|
||||||
|
return redirect()->route('user.peminjaman.create')
|
||||||
|
->with('error', 'Anda belum dapat meminjam buku sebelum disetujui oleh admin.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'koleksi_id' => 'required|exists:koleksis,biblio_id',
|
||||||
|
'tanggal_pinjam' => 'required|date',
|
||||||
|
'surat_pengantar' => 'nullable|file|mimes:pdf|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$alreadyBorrowed = BorrowTransaction::where('koleksi_id', $request->koleksi_id)
|
||||||
|
->whereIn('status', ['menunggu', 'disetujui', 'dipinjam'])
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if ($alreadyBorrowed) {
|
||||||
|
return back()->withErrors(['koleksi_id' => 'Buku ini sedang dalam proses peminjaman.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$pdfFilename = null;
|
||||||
|
if ($request->hasFile('surat_pengantar')) {
|
||||||
|
$file = $request->file('surat_pengantar');
|
||||||
|
if (!Storage::exists('public/surat_pengantar')) {
|
||||||
|
Storage::makeDirectory('public/surat_pengantar');
|
||||||
|
}
|
||||||
|
$pdfFilename = time() . '_' . $file->getClientOriginalName();
|
||||||
|
$file->storeAs('public/surat_pengantar', $pdfFilename);
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction = BorrowTransaction::create([
|
||||||
|
'anggota_id' => $anggota->id,
|
||||||
|
'koleksi_id' => $request->koleksi_id,
|
||||||
|
'tanggal_pinjam' => $request->tanggal_pinjam,
|
||||||
|
'status' => 'menunggu',
|
||||||
|
'surat_pengantar' => $pdfFilename,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (env('MAIL_USERNAME')) {
|
||||||
|
try {
|
||||||
|
Mail::send('emails.peminjaman_baru', [
|
||||||
|
'anggota' => $anggota,
|
||||||
|
'transaction' => $transaction,
|
||||||
|
], function ($message) {
|
||||||
|
$message->to(config('mail.from.address'))
|
||||||
|
->subject('📚 Pengajuan Peminjaman Buku Baru');
|
||||||
|
});
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
\Log::error('Gagal mengirim email peminjaman ke admin: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('user.peminjaman.index')
|
||||||
|
->with('success', 'Pengajuan peminjaman berhasil dikirim! Menunggu persetujuan admin.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function kembalikan($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if ($transaction->status != 'dipinjam') {
|
||||||
|
return redirect()->route('user.peminjaman.index')
|
||||||
|
->with('error', 'Buku belum dapat dikembalikan atau sudah dikembalikan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction->markAsPengembalianMenunggu();
|
||||||
|
|
||||||
|
if (env('MAIL_USERNAME')) {
|
||||||
|
try {
|
||||||
|
Mail::to(config('mail.from.address'))
|
||||||
|
->send(new PengembalianMenungguApproval($transaction));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return back()->with('error', 'Gagal mengirim email ke admin: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('user.peminjaman.index')
|
||||||
|
->with('success', 'Permintaan pengembalian dikirim! Menunggu persetujuan admin.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function ajukanPerpanjangan($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if ($transaction->status !== 'dipinjam') {
|
||||||
|
return redirect()->route('user.peminjaman.index')
|
||||||
|
->with('error', 'Hanya buku yang sedang dipinjam yang bisa diperpanjang.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($transaction->perpanjangan_diajukan) {
|
||||||
|
return back()->with('error', 'Anda sudah pernah mengajukan perpanjangan untuk buku ini.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction->status = 'perpanjangan_menunggu';
|
||||||
|
$transaction->perpanjangan_diajukan = true;
|
||||||
|
$transaction->save();
|
||||||
|
|
||||||
|
if (env('MAIL_USERNAME')) {
|
||||||
|
try {
|
||||||
|
Mail::to(config('mail.from.address'))
|
||||||
|
->send(new PerpanjanganMenungguApproval($transaction));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return back()->with('error', 'Gagal mengirim email perpanjangan: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('user.peminjaman.index')
|
||||||
|
->with('success', 'Permintaan perpanjangan telah dikirim! Menunggu persetujuan admin.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setujuiPerpanjangan($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if ($transaction->status !== 'perpanjangan_menunggu') {
|
||||||
|
return back()->with('error', 'Status transaksi tidak valid.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction->tanggal_kembali = Carbon::parse($transaction->tanggal_kembali)->addDays(7);
|
||||||
|
$transaction->status = 'dipinjam';
|
||||||
|
$transaction->perpanjangan_disetujui = true;
|
||||||
|
$transaction->save();
|
||||||
|
|
||||||
|
return back()->with('success', 'Perpanjangan berhasil disetujui (7 hari).');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tolakPerpanjangan($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if ($transaction->status !== 'perpanjangan_menunggu') {
|
||||||
|
return back()->with('error', 'Status transaksi tidak valid.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction->status = 'dipinjam';
|
||||||
|
$transaction->perpanjangan_disetujui = false;
|
||||||
|
$transaction->save();
|
||||||
|
|
||||||
|
return back()->with('success', 'Permintaan perpanjangan ditolak.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function penilaian($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if ($transaction->status !== 'dikembalikan') {
|
||||||
|
return redirect()->route('user.peminjaman.index')
|
||||||
|
->with('error', 'Pengembalian belum disetujui admin.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('user.rating.form', compact('transaction'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function simpanPenilaian(Request $request, $id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'rating' => 'required|integer|min:1|max:5',
|
||||||
|
'feedback' => 'nullable|string|max:500',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Rating::create([
|
||||||
|
'user_id' => Auth::id(),
|
||||||
|
'borrow_transaction_id' => $transaction->id,
|
||||||
|
'rating' => $request->rating,
|
||||||
|
'feedback' => $request->feedback,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('user.peminjaman.index')
|
||||||
|
->with('success', 'Terima kasih atas penilaian Anda!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function downloadSuratPengantar($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if (!$transaction->surat_pengantar) {
|
||||||
|
return back()->with('error', 'Surat pengantar tidak ditemukan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = 'public/surat_pengantar/' . $transaction->surat_pengantar;
|
||||||
|
|
||||||
|
if (!Storage::exists($path)) {
|
||||||
|
return back()->with('error', 'File surat pengantar tidak ditemukan di server.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return Storage::download($path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class UserProfileController extends Controller
|
||||||
|
{
|
||||||
|
public function index() {
|
||||||
|
$user = Auth::user();
|
||||||
|
return view('profile', compact('user'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateProfile(Request $request) {
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'email' => 'required|email|max:255|unique:users,email,'.Auth::id(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = Auth::user();
|
||||||
|
$user->name = $request->name;
|
||||||
|
$user->email = $request->email;
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
return redirect()->route('user.profile')->with('success', 'Profil berhasil diperbarui!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updatePassword(Request $request) {
|
||||||
|
$request->validate([
|
||||||
|
'current_password' => 'required',
|
||||||
|
'new_password' => 'required|string|min:8|confirmed',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!Hash::check($request->current_password, $user->password)) {
|
||||||
|
return back()->withErrors(['current_password' => 'Password saat ini salah']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->password = Hash::make($request->new_password);
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
return redirect()->route('user.profile')->with('success', 'Password berhasil diperbarui!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\User;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
use App\Models\Rating;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class UserRatingController extends Controller
|
||||||
|
{
|
||||||
|
public function form($id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
if ($transaction->status !== 'dikembalikan') {
|
||||||
|
return redirect()->route('user.peminjaman.index')
|
||||||
|
->with('error', 'Anda hanya bisa memberi penilaian setelah pengembalian disetujui admin.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$existingRating = Rating::where('user_id', Auth::id())
|
||||||
|
->where('borrow_transaction_id', $transaction->id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
return view('user.rating.form', compact('transaction', 'existingRating'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request, $id)
|
||||||
|
{
|
||||||
|
$transaction = BorrowTransaction::findOrFail($id);
|
||||||
|
|
||||||
|
$existingRating = Rating::where('user_id', Auth::id())
|
||||||
|
->where('borrow_transaction_id', $transaction->id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($existingRating) {
|
||||||
|
return redirect()->route('user.peminjaman.index')
|
||||||
|
->with('error', 'Anda sudah memberi penilaian untuk transaksi ini.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'rating' => 'required|integer|min:1|max:5',
|
||||||
|
'feedback' => 'nullable|string|max:500',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Rating::create([
|
||||||
|
'user_id' => Auth::id(),
|
||||||
|
'borrow_transaction_id' => $transaction->id,
|
||||||
|
'rating' => $request->rating,
|
||||||
|
'feedback' => $request->feedback,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('user.peminjaman.index')
|
||||||
|
->with('success', 'Terima kasih! Penilaian Anda telah kami terima 🙏');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Koleksi;
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
|
||||||
|
class UserController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('user.dashboard');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function koleksi()
|
||||||
|
{
|
||||||
|
$books = Koleksi::all();
|
||||||
|
return view('user.koleksi', compact('books'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pinjaman()
|
||||||
|
{
|
||||||
|
$transactions = BorrowTransaction::where('user_id', auth()->id())->get();
|
||||||
|
return view('user.pinjaman', compact('transactions'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function anggota()
|
||||||
|
{
|
||||||
|
return view('user.anggota');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class UserDashboardController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('user.dashboard');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||||
|
|
||||||
|
class Kernel extends HttpKernel
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $middleware = [
|
||||||
|
\App\Http\Middleware\TrustProxies::class,
|
||||||
|
\Illuminate\Http\Middleware\HandleCors::class,
|
||||||
|
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||||
|
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||||
|
\App\Http\Middleware\TrimStrings::class,
|
||||||
|
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $middlewareGroups = [
|
||||||
|
'web' => [
|
||||||
|
\App\Http\Middleware\EncryptCookies::class,
|
||||||
|
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||||
|
\Illuminate\Session\Middleware\StartSession::class,
|
||||||
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||||
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
\App\Http\Middleware\SetLocale::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'api' => [
|
||||||
|
'throttle:api',
|
||||||
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
protected $routeMiddleware = [
|
||||||
|
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||||
|
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||||
|
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class AdminMiddleware
|
||||||
|
{
|
||||||
|
public function handle(Request $request, Closure $next)
|
||||||
|
{
|
||||||
|
if (auth()->check() && auth()->user()->role === 'admin') {
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
abort(403, 'Akses ditolak!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class CheckRole
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next, string $role): Response
|
||||||
|
{
|
||||||
|
if (!auth()->check()) {
|
||||||
|
return redirect('/login');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auth()->user()->role !== $role) {
|
||||||
|
abort(403, 'Akses Ditolak. Anda tidak memiliki izin yang diperlukan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class SetLocale
|
||||||
|
{
|
||||||
|
public function handle(Request $request, Closure $next): Response
|
||||||
|
{
|
||||||
|
$locale = session('locale', config('app.locale')); // default: 'id'
|
||||||
|
app()->setLocale($locale);
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use App\Models\Anggota;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class AdminNotifikasiAnggotaBaru extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $anggota;
|
||||||
|
|
||||||
|
public function __construct(Anggota $anggota)
|
||||||
|
{
|
||||||
|
$this->anggota = $anggota;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('Pendaftaran Anggota Baru - Menunggu Persetujuan')
|
||||||
|
->markdown('emails.admin.anggota_baru');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use App\Models\Anggota;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class AnggotaBaruMenungguPersetujuan extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $anggota;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*/
|
||||||
|
public function __construct(Anggota $anggota)
|
||||||
|
{
|
||||||
|
$this->anggota = $anggota;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the message.
|
||||||
|
*/
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('🕒 Anggota Baru Menunggu Persetujuan')
|
||||||
|
->view('emails.anggota_baru_menunggu');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
|
||||||
|
class BukuDikembalikanMail extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $transaction;
|
||||||
|
|
||||||
|
public function __construct(BorrowTransaction $transaction)
|
||||||
|
{
|
||||||
|
$this->transaction = $transaction->loadMissing(['anggota', 'koleksi']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('Konfirmasi Pengembalian Buku')
|
||||||
|
->view('emails.buku_dikembalikan')
|
||||||
|
->with([
|
||||||
|
'transaction' => $this->transaction,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class BukuSiapDiambilMail extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $transaction;
|
||||||
|
|
||||||
|
public function __construct($transaction)
|
||||||
|
{
|
||||||
|
$this->transaction = $transaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('Buku Siap Diambil di Perpustakaan')
|
||||||
|
->view('emails.buku_siap_diambil');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class PeminjamanDitolakMail extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $transaction;
|
||||||
|
|
||||||
|
public function __construct($transaction)
|
||||||
|
{
|
||||||
|
$this->transaction = $transaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('Peminjaman Ditolak')
|
||||||
|
->view('emails.peminjaman_ditolak');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
|
||||||
|
class PeminjamanMenungguApproval extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $borrow;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct(BorrowTransaction $borrow)
|
||||||
|
{
|
||||||
|
$this->borrow = $borrow;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('📚 Pengajuan Peminjaman Baru - Pustaka Nawasena')
|
||||||
|
->view('emails.peminjaman_menunggu');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
|
||||||
|
class PengembalianMenungguApproval extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $transaction;
|
||||||
|
|
||||||
|
public function __construct(BorrowTransaction $transaction)
|
||||||
|
{
|
||||||
|
$this->transaction = $transaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('Permintaan Pengembalian Buku')
|
||||||
|
->view('emails.pengembalian-menunggu');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class PeringatanKeterlambatanMail extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $peminjaman;
|
||||||
|
|
||||||
|
public function __construct($peminjaman)
|
||||||
|
{
|
||||||
|
$this->peminjaman = $peminjaman;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('Peringatan Keterlambatan Peminjaman')
|
||||||
|
->markdown('emails.peringatan');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class PerpanjanganDisetujuiMail extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $transaction;
|
||||||
|
|
||||||
|
public function __construct(BorrowTransaction $transaction)
|
||||||
|
{
|
||||||
|
$this->transaction = $transaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('Perpanjangan Peminjaman Buku Disetujui')
|
||||||
|
->view('emails.perpanjangan_disetujui');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class PerpanjanganDitolakMail extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $transaction;
|
||||||
|
|
||||||
|
public function __construct(BorrowTransaction $transaction)
|
||||||
|
{
|
||||||
|
$this->transaction = $transaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('Permintaan Perpanjangan Peminjaman Ditolak')
|
||||||
|
->view('emails.perpanjangan_ditolak');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use App\Models\BorrowTransaction;
|
||||||
|
|
||||||
|
class PerpanjanganMenungguApproval extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $transaction;
|
||||||
|
|
||||||
|
public function __construct(BorrowTransaction $transaction)
|
||||||
|
{
|
||||||
|
$this->transaction = $transaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('Permintaan Perpanjangan Peminjaman Buku')
|
||||||
|
->view('emails.perpanjangan_menunggu');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class SendOtpMail extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $user;
|
||||||
|
public $otp;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct($user, $otp)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
$this->otp = $otp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->markdown('emails.send-otp')
|
||||||
|
->subject('Kode Verifikasi Akun Anda - Pustaka Nawasena Bakorwil III Malang')
|
||||||
|
->with([
|
||||||
|
'name' => $this->user->name,
|
||||||
|
'otp' => $this->otp,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use App\Models\Anggota;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class StatusAnggotaDiperbarui extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $anggota;
|
||||||
|
|
||||||
|
public function __construct(Anggota $anggota)
|
||||||
|
{
|
||||||
|
$this->anggota = $anggota;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('Status Pendaftaran Anggota Anda Diperbarui')
|
||||||
|
->view('emails.status_anggota_diperbarui');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Anggota extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
|
||||||
|
protected $table = 'anggota';
|
||||||
|
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'nama',
|
||||||
|
'email',
|
||||||
|
'alamat',
|
||||||
|
'no_hp',
|
||||||
|
'user_id',
|
||||||
|
'status',
|
||||||
|
'nip_nim',
|
||||||
|
'foto',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public function borrowTransactions()
|
||||||
|
{
|
||||||
|
return $this->hasMany(BorrowTransaction::class, 'anggota_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'user_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getFormattedNameAttribute()
|
||||||
|
{
|
||||||
|
return ucwords(strtolower($this->nama));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getFormattedNipNimAttribute()
|
||||||
|
{
|
||||||
|
return $this->nip_nim ? strtoupper($this->nip_nim) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function hasActiveBorrow()
|
||||||
|
{
|
||||||
|
return $this->borrowTransactions()
|
||||||
|
->whereIn('status', ['dipinjam', 'menunggu', 'disetujui'])
|
||||||
|
->exists();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Book extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'judul',
|
||||||
|
'penulis',
|
||||||
|
'penerbit',
|
||||||
|
'tahun_terbit',
|
||||||
|
'kategori',
|
||||||
|
'jumlah_eksemplar',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function borrowTransactions()
|
||||||
|
{
|
||||||
|
return $this->hasMany(BorrowTransaction::class, 'book_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function availableCopies()
|
||||||
|
{
|
||||||
|
$borrowed = $this->borrowTransactions()
|
||||||
|
->where('status', 'dipinjam')
|
||||||
|
->count();
|
||||||
|
|
||||||
|
return $this->jumlah_eksemplar - $borrowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFormattedTitleAttribute()
|
||||||
|
{
|
||||||
|
return ucwords(strtolower($this->judul));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,233 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use App\Mail\PeminjamanMenungguApproval;
|
||||||
|
|
||||||
|
class BorrowTransaction extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'borrow_transactions';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'anggota_id',
|
||||||
|
'koleksi_id',
|
||||||
|
'tanggal_pinjam',
|
||||||
|
'pickup_date',
|
||||||
|
'pickup_time',
|
||||||
|
'tanggal_kembali',
|
||||||
|
'status',
|
||||||
|
'surat_pengantar',
|
||||||
|
|
||||||
|
'tanggal_perpanjangan',
|
||||||
|
'alasan_perpanjangan',
|
||||||
|
'perpanjangan_diajukan',
|
||||||
|
'perpanjangan_disetujui',
|
||||||
|
];
|
||||||
|
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
|
||||||
|
public function anggota()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(\App\Models\Anggota::class, 'anggota_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function koleksi()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(\App\Models\Koleksi::class, 'koleksi_id', 'biblio_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function scopeMenunggu($query)
|
||||||
|
{
|
||||||
|
return $query->where('status', 'menunggu');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeDisetujui($query)
|
||||||
|
{
|
||||||
|
return $query->where('status', 'disetujui');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeDipinjam($query)
|
||||||
|
{
|
||||||
|
return $query->where('status', 'dipinjam');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeDikembalikan($query)
|
||||||
|
{
|
||||||
|
return $query->where('status', 'dikembalikan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeDitolak($query)
|
||||||
|
{
|
||||||
|
return $query->where('status', 'ditolak');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopePengembalianMenunggu($query)
|
||||||
|
{
|
||||||
|
return $query->where('status', 'pengembalian_menunggu');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopePerpanjanganMenunggu($query)
|
||||||
|
{
|
||||||
|
return $query->where('status', 'perpanjangan_menunggu');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function sudahDipinjam($koleksiId)
|
||||||
|
{
|
||||||
|
return self::where('koleksi_id', $koleksiId)
|
||||||
|
->whereIn('status', ['dipinjam', 'menunggu', 'disetujui'])
|
||||||
|
->exists();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function markAsDisetujui($pickupDate = null)
|
||||||
|
{
|
||||||
|
$this->status = 'disetujui';
|
||||||
|
$this->pickup_date = $pickupDate ? Carbon::parse($pickupDate) : Carbon::today();
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function markAsDipinjam()
|
||||||
|
{
|
||||||
|
$this->status = 'dipinjam';
|
||||||
|
$this->tanggal_pinjam = Carbon::today();
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function markAsDitolak()
|
||||||
|
{
|
||||||
|
$this->status = 'ditolak';
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function markAsDikembalikan()
|
||||||
|
{
|
||||||
|
$this->status = 'dikembalikan';
|
||||||
|
$this->tanggal_kembali = Carbon::today();
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function markAsPengembalianMenunggu()
|
||||||
|
{
|
||||||
|
$this->status = 'pengembalian_menunggu';
|
||||||
|
$this->tanggal_kembali = null;
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function ajukanPerpanjangan($tanggalBaru, $alasan)
|
||||||
|
{
|
||||||
|
if ($this->perpanjangan_diajukan) {
|
||||||
|
throw new \Exception('Anda sudah pernah mengajukan perpanjangan untuk buku ini.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->tanggal_perpanjangan = Carbon::parse($tanggalBaru);
|
||||||
|
$this->alasan_perpanjangan = $alasan;
|
||||||
|
$this->status = 'perpanjangan_menunggu';
|
||||||
|
$this->perpanjangan_diajukan = true;
|
||||||
|
$this->perpanjangan_disetujui = null;
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setujuiPerpanjangan()
|
||||||
|
{
|
||||||
|
$this->tanggal_kembali = $this->tanggal_perpanjangan;
|
||||||
|
$this->status = 'dipinjam';
|
||||||
|
$this->perpanjangan_disetujui = true;
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function tolakPerpanjangan()
|
||||||
|
{
|
||||||
|
$this->status = 'dipinjam';
|
||||||
|
$this->perpanjangan_disetujui = false;
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getIsBorrowedAttribute()
|
||||||
|
{
|
||||||
|
return $this->status === 'dipinjam';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIsApprovedAttribute()
|
||||||
|
{
|
||||||
|
return $this->status === 'disetujui';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIsReturnPendingAttribute()
|
||||||
|
{
|
||||||
|
return $this->status === 'pengembalian_menunggu';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIsExtensionPendingAttribute()
|
||||||
|
{
|
||||||
|
return $this->status === 'perpanjangan_menunggu';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIsExtensionApprovedAttribute()
|
||||||
|
{
|
||||||
|
return $this->perpanjangan_disetujui === true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIsExtensionRejectedAttribute()
|
||||||
|
{
|
||||||
|
return $this->perpanjangan_disetujui === false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function canBeExtended()
|
||||||
|
{
|
||||||
|
return $this->status === 'dipinjam' && !$this->perpanjangan_diajukan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canBeReturnedByUser()
|
||||||
|
{
|
||||||
|
return $this->status === 'dipinjam';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canBeRated()
|
||||||
|
{
|
||||||
|
return $this->status === 'dikembalikan';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function isLate()
|
||||||
|
{
|
||||||
|
if (!$this->tanggal_kembali) return false;
|
||||||
|
return Carbon::now()->greaterThan(Carbon::parse($this->tanggal_kembali));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getLateDays()
|
||||||
|
{
|
||||||
|
if (!$this->isLate()) return 0;
|
||||||
|
return Carbon::parse($this->tanggal_kembali)->diffInDays(Carbon::now());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::created(function ($transaction) {
|
||||||
|
if (env('MAIL_USERNAME')) {
|
||||||
|
try {
|
||||||
|
Mail::to(config('mail.from.address'))
|
||||||
|
->send(new PeminjamanMenungguApproval($transaction));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
\Log::error('Gagal mengirim email peminjaman ke admin: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Fasilitas extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'nama',
|
||||||
|
'jenis',
|
||||||
|
'deskripsi',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Item extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class Koleksi extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'koleksis';
|
||||||
|
protected $primaryKey = 'biblio_id';
|
||||||
|
public $incrementing = true;
|
||||||
|
protected $keyType = 'int';
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'sor',
|
||||||
|
'edition',
|
||||||
|
'isbn_issn',
|
||||||
|
'publisher_id',
|
||||||
|
'publish_year',
|
||||||
|
'collation',
|
||||||
|
'series_title',
|
||||||
|
'call_number',
|
||||||
|
'language_id',
|
||||||
|
'source',
|
||||||
|
'publish_place_id',
|
||||||
|
'classification',
|
||||||
|
'notes',
|
||||||
|
'image',
|
||||||
|
'file_att',
|
||||||
|
'opac_hide',
|
||||||
|
'promoted',
|
||||||
|
'labels',
|
||||||
|
'frequency_id',
|
||||||
|
'spec_detail_info',
|
||||||
|
'content_type_id',
|
||||||
|
'media_type_id',
|
||||||
|
'carrier_type_id',
|
||||||
|
'input_date',
|
||||||
|
'last_update',
|
||||||
|
'uid',
|
||||||
|
'kode_eksemplar',
|
||||||
|
'qr_code',
|
||||||
|
'barcode',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public function getRouteKeyName()
|
||||||
|
{
|
||||||
|
return 'kode_eksemplar';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function borrowTransactions()
|
||||||
|
{
|
||||||
|
return $this->hasMany(BorrowTransaction::class, 'koleksi_id', 'biblio_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function scopeBorrowed($query)
|
||||||
|
{
|
||||||
|
return $query->whereHas('borrowTransactions', function ($q) {
|
||||||
|
$q->whereIn('status', ['dipinjam', 'disetujui', 'pengembalian_menunggu']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function scopeAvailable($query)
|
||||||
|
{
|
||||||
|
return $query->whereDoesntHave('borrowTransactions', function ($q) {
|
||||||
|
$q->whereIn('status', ['dipinjam', 'disetujui', 'pengembalian_menunggu']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function isBorrowed()
|
||||||
|
{
|
||||||
|
return $this->borrowTransactions()
|
||||||
|
->whereIn('status', ['dipinjam', 'disetujui', 'pengembalian_menunggu'])
|
||||||
|
->exists();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getStatusAttribute()
|
||||||
|
{
|
||||||
|
return $this->isBorrowed() ? 'Dipinjam' : 'Tersedia';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function scopeWithStatus($query)
|
||||||
|
{
|
||||||
|
return $query->with(['borrowTransactions' => function ($q) {
|
||||||
|
$q->latest();
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getBarcodeUrlAttribute()
|
||||||
|
{
|
||||||
|
if ($this->barcode && Storage::disk('public')->exists($this->barcode)) {
|
||||||
|
return asset('storage/' . $this->barcode);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function hasBarcode()
|
||||||
|
{
|
||||||
|
return $this->barcode && Storage::disk('public')->exists($this->barcode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Member extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'nama',
|
||||||
|
'email',
|
||||||
|
'alamat',
|
||||||
|
'user_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
public function user() {
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Peminjaman extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'borrow_transactions';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'member_id',
|
||||||
|
'koleksi_id',
|
||||||
|
'tgl_peminjaman',
|
||||||
|
'tgl_pengembalian',
|
||||||
|
'status',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function member()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Member::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function koleksi()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Koleksi::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class PublishPlace extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Publisher extends Model
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Rating extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'borrow_transaction_id',
|
||||||
|
'rating',
|
||||||
|
'feedback'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function transaction()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(BorrowTransaction::class, 'borrow_transaction_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Setting extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'nama_lembaga',
|
||||||
|
'alamat',
|
||||||
|
'logo',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
|
use Filament\Models\Contracts\FilamentUser;
|
||||||
|
use Filament\Panel;
|
||||||
|
use App\Models\UserLogin;
|
||||||
|
|
||||||
|
class User extends Authenticatable implements FilamentUser, MustVerifyEmail
|
||||||
|
{
|
||||||
|
use HasFactory, Notifiable;
|
||||||
|
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'email',
|
||||||
|
'password',
|
||||||
|
'role',
|
||||||
|
'email_otp',
|
||||||
|
'email_otp_expires_at',
|
||||||
|
'otp_expires_at',
|
||||||
|
'otp_last_sent_at',
|
||||||
|
'verification_token',
|
||||||
|
'email_verified_at',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
protected $hidden = [
|
||||||
|
'password',
|
||||||
|
'remember_token',
|
||||||
|
'email_otp',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'email_verified_at' => 'datetime',
|
||||||
|
'email_otp_expires_at' => 'datetime',
|
||||||
|
'otp_expires_at' => 'datetime',
|
||||||
|
'otp_last_sent_at' => 'datetime',
|
||||||
|
'password' => 'hashed',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public function canAccessPanel(Panel $panel): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function logins()
|
||||||
|
{
|
||||||
|
return $this->hasMany(UserLogin::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function transactions()
|
||||||
|
{
|
||||||
|
return $this->hasMany(\App\Models\BorrowTransaction::class, 'anggota_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function anggota()
|
||||||
|
{
|
||||||
|
return $this->hasOne(\App\Models\Anggota::class, 'user_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getRecentLogins($perPage = 10)
|
||||||
|
{
|
||||||
|
return $this->logins()->latest()->paginate($perPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function sendEmailVerificationNotification()
|
||||||
|
{
|
||||||
|
$this->notify(new \Illuminate\Auth\Notifications\VerifyEmail());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class UserLogin extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'ip_address',
|
||||||
|
'user_agent',
|
||||||
|
'location',
|
||||||
|
'status'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setStatusAttribute($value)
|
||||||
|
{
|
||||||
|
$this->attributes['status'] = strtolower($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getCreatedAtFormattedAttribute()
|
||||||
|
{
|
||||||
|
return $this->created_at->format('d M Y H:i:s');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $userId
|
||||||
|
* @param string $status
|
||||||
|
* @param string|null $location
|
||||||
|
* @param string|null $ipAddress
|
||||||
|
* @param string|null $userAgent
|
||||||
|
*/
|
||||||
|
public static function record(
|
||||||
|
int $userId,
|
||||||
|
string $status = 'success',
|
||||||
|
string $location = null,
|
||||||
|
string $ipAddress = null,
|
||||||
|
string $userAgent = null
|
||||||
|
) {
|
||||||
|
self::create([
|
||||||
|
'user_id' => $userId,
|
||||||
|
'status' => $status,
|
||||||
|
'location' => $location,
|
||||||
|
'ip_address' => $ipAddress ?? request()->ip(),
|
||||||
|
'user_agent' => $userAgent ?? request()->userAgent(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function scopeLatestLogins($query, $limit = 10)
|
||||||
|
{
|
||||||
|
return $query->latest()->limit($limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function detectLocation()
|
||||||
|
{
|
||||||
|
if (class_exists(\Stevebauman\Location\Facades\Location::class)) {
|
||||||
|
$location = \Location::get(request()->ip());
|
||||||
|
return $location ? $location->cityName . ', ' . $location->countryName : null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
class PerpanjanganPeminjamanNotification extends Notification
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return array<int, string>
|
||||||
|
*/
|
||||||
|
public function via(object $notifiable): array
|
||||||
|
{
|
||||||
|
return ['mail'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function toMail(object $notifiable): MailMessage
|
||||||
|
{
|
||||||
|
return (new MailMessage)
|
||||||
|
->line('The introduction to the notification.')
|
||||||
|
->action('Notification Action', url('/'))
|
||||||
|
->line('Thank you for using our application!');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function toArray(object $notifiable): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class AppServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers\Filament;
|
||||||
|
|
||||||
|
use Filament\Http\Middleware\Authenticate;
|
||||||
|
use Filament\Http\Middleware\AuthenticateSession;
|
||||||
|
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||||
|
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||||
|
use Filament\Pages;
|
||||||
|
use Filament\Panel;
|
||||||
|
use Filament\PanelProvider;
|
||||||
|
use Filament\Support\Colors\Color;
|
||||||
|
use Filament\Widgets;
|
||||||
|
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||||
|
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||||
|
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||||
|
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||||
|
use Illuminate\Session\Middleware\StartSession;
|
||||||
|
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||||
|
|
||||||
|
class AdminPanelProvider extends PanelProvider
|
||||||
|
{
|
||||||
|
public function panel(Panel $panel): Panel
|
||||||
|
{
|
||||||
|
return $panel
|
||||||
|
->id('admin')
|
||||||
|
->path('admin')
|
||||||
|
->login()
|
||||||
|
->authGuard('web')
|
||||||
|
->colors([
|
||||||
|
'primary' => Color::Amber,
|
||||||
|
])
|
||||||
|
->discoverResources(in: app_path('Filament/Admin/Resources'), for: 'App\\Filament\\Admin\\Resources')
|
||||||
|
->discoverPages(in: app_path('Filament/Admin/Pages'), for: 'App\\Filament\\Admin\\Pages')
|
||||||
|
->pages([
|
||||||
|
Pages\Dashboard::class,
|
||||||
|
])
|
||||||
|
->discoverWidgets(in: app_path('Filament/Admin/Widgets'), for: 'App\\Filament\\Admin\\Widgets')
|
||||||
|
->widgets([
|
||||||
|
Widgets\AccountWidget::class,
|
||||||
|
Widgets\FilamentInfoWidget::class,
|
||||||
|
])
|
||||||
|
->middleware([
|
||||||
|
EncryptCookies::class,
|
||||||
|
AddQueuedCookiesToResponse::class,
|
||||||
|
StartSession::class,
|
||||||
|
AuthenticateSession::class,
|
||||||
|
ShareErrorsFromSession::class,
|
||||||
|
VerifyCsrfToken::class,
|
||||||
|
SubstituteBindings::class,
|
||||||
|
DisableBladeIconComponents::class,
|
||||||
|
DispatchServingFilamentEvent::class,
|
||||||
|
])
|
||||||
|
->authMiddleware([
|
||||||
|
Authenticate::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
|
class RouteServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
|
||||||
|
public const HOME = '/home';
|
||||||
|
|
||||||
|
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
$this->routes(function () {
|
||||||
|
Route::middleware('web')
|
||||||
|
->group(base_path('routes/web.php'));
|
||||||
|
|
||||||
|
Route::middleware(['web', 'auth', 'is_admin'])
|
||||||
|
->group(base_path('routes/admin.php'));
|
||||||
|
|
||||||
|
Route::middleware(['web', 'auth', 'is_user'])
|
||||||
|
->group(base_path('routes/user.php'));
|
||||||
|
|
||||||
|
Route::prefix('api')
|
||||||
|
->middleware('api')
|
||||||
|
->group(base_path('routes/api.php'));
|
||||||
|
|
||||||
|
Route::middleware('web')
|
||||||
|
->group(base_path('routes/guest.php'));
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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,18 @@
|
||||||
|
<?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): void {
|
||||||
|
//
|
||||||
|
})
|
||||||
|
->withExceptions(function (Exceptions $exceptions): void {
|
||||||
|
//
|
||||||
|
})->create();
|
||||||
|
|
@ -0,0 +1,196 @@
|
||||||
|
<?php return array (
|
||||||
|
'anourvalar/eloquent-serialize' =>
|
||||||
|
array (
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'EloquentSerialize' => 'AnourValar\\EloquentSerialize\\Facades\\EloquentSerializeFacade',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'barryvdh/laravel-dompdf' =>
|
||||||
|
array (
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'PDF' => 'Barryvdh\\DomPDF\\Facade\\Pdf',
|
||||||
|
'Pdf' => 'Barryvdh\\DomPDF\\Facade\\Pdf',
|
||||||
|
),
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Barryvdh\\DomPDF\\ServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'blade-ui-kit/blade-heroicons' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'BladeUI\\Heroicons\\BladeHeroiconsServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'blade-ui-kit/blade-icons' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'BladeUI\\Icons\\BladeIconsServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'filament/actions' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Filament\\Actions\\ActionsServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'filament/filament' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Filament\\FilamentServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'filament/forms' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Filament\\Forms\\FormsServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'filament/infolists' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Filament\\Infolists\\InfolistsServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'filament/notifications' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Filament\\Notifications\\NotificationsServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'filament/support' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Filament\\Support\\SupportServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'filament/tables' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Filament\\Tables\\TablesServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'filament/widgets' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Filament\\Widgets\\WidgetsServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'kirschbaum-development/eloquent-power-joins' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Kirschbaum\\PowerJoins\\PowerJoinsServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'laravel/pail' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Laravel\\Pail\\PailServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'laravel/sail' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Laravel\\Sail\\SailServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'laravel/socialite' =>
|
||||||
|
array (
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'Socialite' => 'Laravel\\Socialite\\Facades\\Socialite',
|
||||||
|
),
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Laravel\\Socialite\\SocialiteServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'laravel/tinker' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Laravel\\Tinker\\TinkerServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'livewire/livewire' =>
|
||||||
|
array (
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'Livewire' => 'Livewire\\Livewire',
|
||||||
|
),
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Livewire\\LivewireServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'milon/barcode' =>
|
||||||
|
array (
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'DNS1D' => 'Milon\\Barcode\\Facades\\DNS1DFacade',
|
||||||
|
'DNS2D' => 'Milon\\Barcode\\Facades\\DNS2DFacade',
|
||||||
|
),
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Milon\\Barcode\\BarcodeServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'nesbot/carbon' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Carbon\\Laravel\\ServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'nunomaduro/collision' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'nunomaduro/termwind' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Termwind\\Laravel\\TermwindServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'ryangjchandler/blade-capture-directive' =>
|
||||||
|
array (
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'BladeCaptureDirective' => 'RyanChandler\\BladeCaptureDirective\\Facades\\BladeCaptureDirective',
|
||||||
|
),
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'RyanChandler\\BladeCaptureDirective\\BladeCaptureDirectiveServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'simplesoftwareio/simple-qrcode' =>
|
||||||
|
array (
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'QrCode' => 'SimpleSoftwareIO\\QrCode\\Facades\\QrCode',
|
||||||
|
),
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,297 @@
|
||||||
|
<?php return array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Illuminate\\Auth\\AuthServiceProvider',
|
||||||
|
1 => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
|
||||||
|
2 => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
3 => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
4 => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
5 => 'Illuminate\\Concurrency\\ConcurrencyServiceProvider',
|
||||||
|
6 => 'Illuminate\\Cookie\\CookieServiceProvider',
|
||||||
|
7 => 'Illuminate\\Database\\DatabaseServiceProvider',
|
||||||
|
8 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
|
||||||
|
9 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
|
||||||
|
10 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
|
||||||
|
11 => 'Illuminate\\Hashing\\HashServiceProvider',
|
||||||
|
12 => 'Illuminate\\Mail\\MailServiceProvider',
|
||||||
|
13 => 'Illuminate\\Notifications\\NotificationServiceProvider',
|
||||||
|
14 => 'Illuminate\\Pagination\\PaginationServiceProvider',
|
||||||
|
15 => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
|
||||||
|
16 => 'Illuminate\\Pipeline\\PipelineServiceProvider',
|
||||||
|
17 => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
18 => 'Illuminate\\Redis\\RedisServiceProvider',
|
||||||
|
19 => 'Illuminate\\Session\\SessionServiceProvider',
|
||||||
|
20 => 'Illuminate\\Translation\\TranslationServiceProvider',
|
||||||
|
21 => 'Illuminate\\Validation\\ValidationServiceProvider',
|
||||||
|
22 => 'Illuminate\\View\\ViewServiceProvider',
|
||||||
|
23 => 'Barryvdh\\DomPDF\\ServiceProvider',
|
||||||
|
24 => 'BladeUI\\Heroicons\\BladeHeroiconsServiceProvider',
|
||||||
|
25 => 'BladeUI\\Icons\\BladeIconsServiceProvider',
|
||||||
|
26 => 'Filament\\Actions\\ActionsServiceProvider',
|
||||||
|
27 => 'Filament\\FilamentServiceProvider',
|
||||||
|
28 => 'Filament\\Forms\\FormsServiceProvider',
|
||||||
|
29 => 'Filament\\Infolists\\InfolistsServiceProvider',
|
||||||
|
30 => 'Filament\\Notifications\\NotificationsServiceProvider',
|
||||||
|
31 => 'Filament\\Support\\SupportServiceProvider',
|
||||||
|
32 => 'Filament\\Tables\\TablesServiceProvider',
|
||||||
|
33 => 'Filament\\Widgets\\WidgetsServiceProvider',
|
||||||
|
34 => 'Kirschbaum\\PowerJoins\\PowerJoinsServiceProvider',
|
||||||
|
35 => 'Laravel\\Pail\\PailServiceProvider',
|
||||||
|
36 => 'Laravel\\Sail\\SailServiceProvider',
|
||||||
|
37 => 'Laravel\\Socialite\\SocialiteServiceProvider',
|
||||||
|
38 => 'Laravel\\Tinker\\TinkerServiceProvider',
|
||||||
|
39 => 'Livewire\\LivewireServiceProvider',
|
||||||
|
40 => 'Milon\\Barcode\\BarcodeServiceProvider',
|
||||||
|
41 => 'Carbon\\Laravel\\ServiceProvider',
|
||||||
|
42 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
|
||||||
|
43 => 'Termwind\\Laravel\\TermwindServiceProvider',
|
||||||
|
44 => 'RyanChandler\\BladeCaptureDirective\\BladeCaptureDirectiveServiceProvider',
|
||||||
|
45 => 'SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider',
|
||||||
|
46 => 'App\\Providers\\AppServiceProvider',
|
||||||
|
47 => 'App\\Providers\\Filament\\AdminPanelProvider',
|
||||||
|
),
|
||||||
|
'eager' =>
|
||||||
|
array (
|
||||||
|
0 => 'Illuminate\\Auth\\AuthServiceProvider',
|
||||||
|
1 => 'Illuminate\\Cookie\\CookieServiceProvider',
|
||||||
|
2 => 'Illuminate\\Database\\DatabaseServiceProvider',
|
||||||
|
3 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
|
||||||
|
4 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
|
||||||
|
5 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
|
||||||
|
6 => 'Illuminate\\Notifications\\NotificationServiceProvider',
|
||||||
|
7 => 'Illuminate\\Pagination\\PaginationServiceProvider',
|
||||||
|
8 => 'Illuminate\\Session\\SessionServiceProvider',
|
||||||
|
9 => 'Illuminate\\View\\ViewServiceProvider',
|
||||||
|
10 => 'Barryvdh\\DomPDF\\ServiceProvider',
|
||||||
|
11 => 'BladeUI\\Heroicons\\BladeHeroiconsServiceProvider',
|
||||||
|
12 => 'BladeUI\\Icons\\BladeIconsServiceProvider',
|
||||||
|
13 => 'Filament\\Actions\\ActionsServiceProvider',
|
||||||
|
14 => 'Filament\\FilamentServiceProvider',
|
||||||
|
15 => 'Filament\\Forms\\FormsServiceProvider',
|
||||||
|
16 => 'Filament\\Infolists\\InfolistsServiceProvider',
|
||||||
|
17 => 'Filament\\Notifications\\NotificationsServiceProvider',
|
||||||
|
18 => 'Filament\\Support\\SupportServiceProvider',
|
||||||
|
19 => 'Filament\\Tables\\TablesServiceProvider',
|
||||||
|
20 => 'Filament\\Widgets\\WidgetsServiceProvider',
|
||||||
|
21 => 'Kirschbaum\\PowerJoins\\PowerJoinsServiceProvider',
|
||||||
|
22 => 'Laravel\\Pail\\PailServiceProvider',
|
||||||
|
23 => 'Livewire\\LivewireServiceProvider',
|
||||||
|
24 => 'Milon\\Barcode\\BarcodeServiceProvider',
|
||||||
|
25 => 'Carbon\\Laravel\\ServiceProvider',
|
||||||
|
26 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
|
||||||
|
27 => 'Termwind\\Laravel\\TermwindServiceProvider',
|
||||||
|
28 => 'RyanChandler\\BladeCaptureDirective\\BladeCaptureDirectiveServiceProvider',
|
||||||
|
29 => 'SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider',
|
||||||
|
30 => 'App\\Providers\\AppServiceProvider',
|
||||||
|
31 => 'App\\Providers\\Filament\\AdminPanelProvider',
|
||||||
|
),
|
||||||
|
'deferred' =>
|
||||||
|
array (
|
||||||
|
'Illuminate\\Broadcasting\\BroadcastManager' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Broadcasting\\Factory' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Broadcasting\\Broadcaster' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
|
||||||
|
'Illuminate\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Bus\\QueueingDispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'Illuminate\\Bus\\BatchRepository' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'Illuminate\\Bus\\DatabaseBatchRepository' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'cache' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'cache.store' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'cache.psr6' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'memcached.connector' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'Illuminate\\Cache\\RateLimiter' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\AboutCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Cache\\Console\\ClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Cache\\Console\\ForgetCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ClearCompiledCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Auth\\Console\\ClearResetsCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ConfigCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ConfigClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ConfigShowCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\DbCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\MonitorCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\PruneCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\ShowCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\TableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\WipeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\DownCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EnvironmentCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EnvironmentDecryptCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EnvironmentEncryptCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EventCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EventClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EventListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Concurrency\\Console\\InvokeSerializedClosureCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\KeyGenerateCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\OptimizeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\OptimizeClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\PackageDiscoverCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Cache\\Console\\PruneStaleTagsCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\ClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\ListFailedCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\FlushFailedCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\ForgetFailedCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\ListenCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\MonitorCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\PruneBatchesCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\PruneFailedJobsCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\RestartCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\RetryCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\RetryBatchCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\WorkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\RouteCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\RouteClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\RouteListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\DumpCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Seeds\\SeedCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleFinishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleRunCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleClearCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleTestCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleWorkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleInterruptCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\ShowModelCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\StorageLinkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\StorageUnlinkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\UpCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ViewCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ViewClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ApiInstallCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\BroadcastingInstallCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Cache\\Console\\CacheTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\CastMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ChannelListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ChannelMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ClassMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ComponentMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ConfigMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ConfigPublishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ConsoleMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Routing\\Console\\ControllerMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\DocsCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EnumMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EventGenerateCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EventMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ExceptionMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Factories\\FactoryMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\InterfaceMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\JobMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\JobMiddlewareMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\LangPublishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ListenerMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\MailMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Routing\\Console\\MiddlewareMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ModelMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\NotificationMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Notifications\\Console\\NotificationTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ObserverMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\PolicyMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ProviderMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\FailedTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\TableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\BatchesTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\RequestMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ResourceMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\RuleMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ScopeMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Seeds\\SeederMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Session\\Console\\SessionTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ServeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\StubPublishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\TestMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\TraitMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\VendorPublishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ViewMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'migrator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'migration.repository' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'migration.creator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Migrations\\Migrator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\MigrateCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\FreshCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\InstallCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\RefreshCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\ResetCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\RollbackCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\StatusCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\MigrateMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'composer' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Concurrency\\ConcurrencyManager' => 'Illuminate\\Concurrency\\ConcurrencyServiceProvider',
|
||||||
|
'hash' => 'Illuminate\\Hashing\\HashServiceProvider',
|
||||||
|
'hash.driver' => 'Illuminate\\Hashing\\HashServiceProvider',
|
||||||
|
'mail.manager' => 'Illuminate\\Mail\\MailServiceProvider',
|
||||||
|
'mailer' => 'Illuminate\\Mail\\MailServiceProvider',
|
||||||
|
'Illuminate\\Mail\\Markdown' => 'Illuminate\\Mail\\MailServiceProvider',
|
||||||
|
'auth.password' => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
|
||||||
|
'auth.password.broker' => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Pipeline\\Hub' => 'Illuminate\\Pipeline\\PipelineServiceProvider',
|
||||||
|
'pipeline' => 'Illuminate\\Pipeline\\PipelineServiceProvider',
|
||||||
|
'queue' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'queue.connection' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'queue.failer' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'queue.listener' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'queue.worker' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'redis' => 'Illuminate\\Redis\\RedisServiceProvider',
|
||||||
|
'redis.connection' => 'Illuminate\\Redis\\RedisServiceProvider',
|
||||||
|
'translator' => 'Illuminate\\Translation\\TranslationServiceProvider',
|
||||||
|
'translation.loader' => 'Illuminate\\Translation\\TranslationServiceProvider',
|
||||||
|
'validator' => 'Illuminate\\Validation\\ValidationServiceProvider',
|
||||||
|
'validation.presence' => 'Illuminate\\Validation\\ValidationServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Validation\\UncompromisedVerifier' => 'Illuminate\\Validation\\ValidationServiceProvider',
|
||||||
|
'Laravel\\Sail\\Console\\InstallCommand' => 'Laravel\\Sail\\SailServiceProvider',
|
||||||
|
'Laravel\\Sail\\Console\\PublishCommand' => 'Laravel\\Sail\\SailServiceProvider',
|
||||||
|
'Laravel\\Socialite\\Contracts\\Factory' => 'Laravel\\Socialite\\SocialiteServiceProvider',
|
||||||
|
'command.tinker' => 'Laravel\\Tinker\\TinkerServiceProvider',
|
||||||
|
),
|
||||||
|
'when' =>
|
||||||
|
array (
|
||||||
|
'Illuminate\\Broadcasting\\BroadcastServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Bus\\BusServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Cache\\CacheServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Concurrency\\ConcurrencyServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Hashing\\HashServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Mail\\MailServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Pipeline\\PipelineServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Queue\\QueueServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Redis\\RedisServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Translation\\TranslationServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Validation\\ValidationServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Laravel\\Sail\\SailServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Laravel\\Socialite\\SocialiteServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Laravel\\Tinker\\TinkerServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
App\Providers\AppServiceProvider::class,
|
||||||
|
App\Providers\Filament\AdminPanelProvider::class,
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
{
|
||||||
|
"$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",
|
||||||
|
"filament/filament": "3.3",
|
||||||
|
"intervention/image": "^3.11",
|
||||||
|
"laravel/framework": "^12.0",
|
||||||
|
"laravel/socialite": "^5.23",
|
||||||
|
"laravel/tinker": "^2.10.1",
|
||||||
|
"milon/barcode": "^12.0",
|
||||||
|
"picqer/php-barcode-generator": "^3.2",
|
||||||
|
"simplesoftwareio/simple-qrcode": "^4.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"fakerphp/faker": "^1.23",
|
||||||
|
"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",
|
||||||
|
"@php artisan filament:upgrade"
|
||||||
|
],
|
||||||
|
"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,
|
||||||
|
"repositories": {
|
||||||
|
"packagist": {
|
||||||
|
"type": "composer",
|
||||||
|
"url": "https://packagist.org"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,64 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'name' => env('APP_NAME', 'Perpustakaan Digital'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'env' => env('APP_ENV', 'production'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'debug' => (bool) env('APP_DEBUG', false),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'url' => env('APP_URL', 'http://localhost'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'timezone' => env('APP_TIMEZONE', 'Asia/Jakarta'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'locale' => env('APP_LOCALE', 'id'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'faker_locale' => env('APP_FAKER_LOCALE', 'id_ID'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'cipher' => 'AES-256-CBC',
|
||||||
|
|
||||||
|
'key' => env('APP_KEY'),
|
||||||
|
|
||||||
|
'previous_keys' => [
|
||||||
|
...array_filter(
|
||||||
|
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
|
||||||
|
),
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'maintenance' => [
|
||||||
|
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
|
||||||
|
'store' => env('APP_MAINTENANCE_STORE', 'database'),
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'upload' => [
|
||||||
|
'path' => 'public/image',
|
||||||
|
'max_size' => 2048,
|
||||||
|
'resize_width' => 300,
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'defaults' => [
|
||||||
|
'guard' => env('AUTH_GUARD', 'web'),
|
||||||
|
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'guards' => [
|
||||||
|
'web' => [
|
||||||
|
'driver' => 'session',
|
||||||
|
'provider' => 'users',
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
'api' => [
|
||||||
|
'driver' => 'token',
|
||||||
|
'provider' => 'users',
|
||||||
|
'hash' => false,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'providers' => [
|
||||||
|
'users' => [
|
||||||
|
'driver' => 'eloquent',
|
||||||
|
'model' => env('AUTH_MODEL', User::class),
|
||||||
|
],
|
||||||
|
|
||||||
|
// Jika pakai database query langsung:
|
||||||
|
// 'users' => [
|
||||||
|
// 'driver' => 'database',
|
||||||
|
// 'table' => 'users',
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'passwords' => [
|
||||||
|
'users' => [
|
||||||
|
'provider' => 'users',
|
||||||
|
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
|
||||||
|
'expire' => 60,
|
||||||
|
'throttle' => 60,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'default' => env('CACHE_STORE', 'database'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'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' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
'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',
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,146 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'default' => env('DB_CONNECTION', 'sqlite'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'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'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'migrations' => [
|
||||||
|
'table' => 'migrations',
|
||||||
|
'update_date_on_publish' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'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,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'broadcasting' => [
|
||||||
|
|
||||||
|
// 'echo' => [
|
||||||
|
// 'broadcaster' => 'pusher',
|
||||||
|
// 'key' => env('VITE_PUSHER_APP_KEY'),
|
||||||
|
// 'cluster' => env('VITE_PUSHER_APP_CLUSTER'),
|
||||||
|
// 'wsHost' => env('VITE_PUSHER_HOST'),
|
||||||
|
// 'wsPort' => env('VITE_PUSHER_PORT'),
|
||||||
|
// 'wssPort' => env('VITE_PUSHER_PORT'),
|
||||||
|
// 'authEndpoint' => '/broadcasting/auth',
|
||||||
|
// 'disableStats' => true,
|
||||||
|
// 'encrypted' => true,
|
||||||
|
// 'forceTLS' => true,
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'default_filesystem_disk' => env('FILAMENT_FILESYSTEM_DISK', 'public'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'assets_path' => null,
|
||||||
|
|
||||||
|
|
||||||
|
'cache_path' => base_path('bootstrap/cache/filament'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'livewire_loading_delay' => 'default',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'auth' => [
|
||||||
|
'guard' => 'web',
|
||||||
|
|
||||||
|
'user_model' => App\Models\User::class,
|
||||||
|
|
||||||
|
'auth_check' => function ($user) {
|
||||||
|
return $user && $user->role === 'admin';
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'path' => env('FILAMENT_PATH', 'admin'),
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||||
|
|
||||||
|
|
||||||
|
'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,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
'links' => [
|
||||||
|
public_path('storage') => storage_path('app/public'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Monolog\Handler\NullHandler;
|
||||||
|
use Monolog\Handler\StreamHandler;
|
||||||
|
use Monolog\Handler\SyslogUdpHandler;
|
||||||
|
use Monolog\Processor\PsrLogMessageProcessor;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'default' => env('LOG_CHANNEL', 'stack'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'deprecations' => [
|
||||||
|
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||||
|
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'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,82 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'default' => env('MAIL_MAILER', 'log'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'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,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'from' => [
|
||||||
|
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||||
|
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
|
||||||
|
'format' => 'png',
|
||||||
|
|
||||||
|
|
||||||
|
'size' => 250,
|
||||||
|
|
||||||
|
|
||||||
|
'margin' => 1,
|
||||||
|
|
||||||
|
|
||||||
|
'errorCorrection' => 'H',
|
||||||
|
|
||||||
|
|
||||||
|
'writer' => 'gd',
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'default' => env('QUEUE_CONNECTION', 'database'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'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,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'batching' => [
|
||||||
|
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||||
|
'table' => 'job_batches',
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'failed' => [
|
||||||
|
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||||
|
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||||
|
'table' => 'failed_jobs',
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'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'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'google' => [
|
||||||
|
'client_id' => env('GOOGLE_CLIENT_ID'),
|
||||||
|
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
|
||||||
|
'redirect' => env('GOOGLE_REDIRECT_URI'),
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'driver' => env('SESSION_DRIVER', 'database'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'lifetime' => (int) env('SESSION_LIFETIME', 120),
|
||||||
|
|
||||||
|
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'encrypt' => env('SESSION_ENCRYPT', false),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'files' => storage_path('framework/sessions'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'connection' => env('SESSION_CONNECTION'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'table' => env('SESSION_TABLE', 'sessions'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'store' => env('SESSION_STORE'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'lottery' => [2, 100],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'cookie' => env(
|
||||||
|
'SESSION_COOKIE',
|
||||||
|
Str::slug((string) env('APP_NAME', 'laravel')) . '-session'
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'path' => env('SESSION_PATH', '/'),
|
||||||
|
|
||||||
|
|
||||||
|
'domain' => env('SESSION_DOMAIN'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||||
|
|
||||||
|
|
||||||
|
'http_only' => env('SESSION_HTTP_ONLY', true),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'same_site' => env('SESSION_SAME_SITE', 'lax'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'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,32 @@
|
||||||
|
<?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();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('users');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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');
|
||||||
|
}
|
||||||
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue