🔧 Technical Documentation
System Architecture
- Framework: Laravel 11.x
- Admin Panel: Filament PHP 3.x
- Database: PostgreSQL 14+
- Authentication: Laravel Sanctum + Spatie Permission
- UI: Livewire + Alpine.js + Tailwind CSS
Database Structure
Main Tables:
accounts (id, no_kel, no_rek, no_bantu, nama, kode, kel)
journal_entries (id, date, ref, description, created_by, deleted_at)
journal_details (id, journal_id, account_id, debit, credit)
users (id, name, email, password, is_verified)
roles (id, name, guard_name)
permissions (id, name, guard_name)
Code Structure
app/
├── Filament/
│ ├── Admin/ # Admin Panel Resources
│ ├── Accounting/ # Accounting Panel Resources
│ └── Widgets/ # Dashboard Widgets
├── Models/ # Eloquent Models
├── Policies/ # Authorization Policies
├── Services/ # Business Logic
└── Traits/ # Reusable Traits
Important Models
JurnalRekeningAir.php
use HasFactory, SoftDeletes, LogsActivity;
protected $fillable = [
'tanggal', 'no_bukti', 'keterangan', 'total_debit',
'total_kredit', 'created_by', 'status'
];
protected static function boot() {
parent::boot();
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
Authorization Flow
- Registration: User registers → Admin verifies → Role assigned
- Roles: super_admin, akuntan, kasir, direktur
- Permissions: Managed via Spatie Permission package
- Policies: Each resource has policy for CRUD operations
Key Features Implementation
1. Soft Deletes
// In model
use SoftDeletes;
// In migration
$table->softDeletes();
// Usage
$jurnal->delete(); // Soft delete
$jurnal->forceDelete(); // Permanent delete
$jurnal->restore(); // Restore
2. Activity Logs
use LogsActivity;
protected static $logAttributes = ['*'];
protected static $logOnlyDirty = true;
// Auto logs: created, updated, deleted
3. Auto created_by
static::creating(function ($model) {
if (auth()->check()) {
$model->created_by = auth()->id();
}
});
API Endpoints (if needed)
POST /api/journals # Create journal
GET /api/journals # List journals
GET /api/journals/{id} # Show journal
PUT /api/journals/{id} # Update journal
DELETE /api/journals/{id} # Delete journal
GET /api/reports/balance # Balance sheet
GET /api/reports/income # Income statement
Error Handling
try {
DB::transaction(function () use ($data) {
$journal = JurnalRekeningAir::create($data);
// Process details...
});
Notification::make()
->success()
->title('Berhasil')
->body('Jurnal berhasil disimpan')
->send();
} catch (\Exception $e) {
Log::error('Journal creation failed: ' . $e->getMessage());
Notification::make()
->danger()
->title('Error')
->body('Terjadi kesalahan: ' . $e->getMessage())
->send();
}
Deployment
- Run migrations:
php artisan migrate
- Seed initial data:
php artisan db:seed
- Clear cache:
php artisan optimize:clear
- Run queue worker:
php artisan queue:work
- Schedule cron:
* * * * * cd /path && php artisan schedule:run
Testing
# Run all tests
php artisan test
# Run specific test
php artisan test --filter JournalTest
# With coverage
php artisan test --coverage
Performance Optimization
- Use eager loading:
with(['details', 'account'])
- Cache queries:
Cache::remember('accounts', 3600, ...)
- Index database columns for faster queries
- Use queue for heavy operations
- Optimize images and assets
📚 Further Reading: Check SECURITY_AUDIT.md, DEPLOYMENT_GUIDE.md, and IMPLEMENTATION_SUMMARY.md for more details.