Admin panel
Add the optional Pondoknusa admin UI for CRUD, policies, and audit logging.
Install
bash
pondoknusa admin:installScaffolds:
config/admin.ts— prefix, middleware, audit log- Admin routes and policies
@pondoknusa/adminprovider registration
Config
typescript
// config/admin.ts
export default {
enabled: env('ADMIN_ENABLED', true),
prefix: env('ADMIN_PREFIX', '/admin'),
middleware: ['web', 'auth'],
accessAbility: 'access-admin',
perPage: 25,
auditLog: { enabled: true, table: 'admin_audit_log' },
};Gate access with a policy ability (access-admin) on your user model.
Every admin resource must declare a policy. Per-resource abilities (viewAny, view, create, update, delete) are enforced through that policy — resources without one are rejected.
File fields support upload hardening:
typescript
{
name: 'avatar',
type: 'file',
file: {
directory: 'avatars',
maxBytes: 2 * 1024 * 1024,
allowedExtensions: ['.png', '.jpg', '.jpeg', '.webp'],
allowedMimeTypes: ['image/png', 'image/jpeg', 'image/webp'],
},
}Usage
- Register models you want to manage in the admin provider stub
- Visit
/admin(or yourprefix) while authenticated with the ability - Audit entries land in
admin_audit_logwhen enabled
Testing
Use @pondoknusa/testing HTTP sugar:
typescript
const response = await t.http
.actingAs(adminUser)
.get('http://localhost/admin');
await response.assertOk();See @pondoknusa/admin in the package reference.