Admin panel
Add the optional Tyravel admin UI for CRUD, policies, and audit logging.
Install
bash
tyravel admin:installScaffolds:
config/admin.ts— prefix, middleware, audit log- Admin routes and policies
@tyravel/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.
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 @tyravel/testing HTTP sugar:
typescript
const response = await t.http
.actingAs(adminUser)
.get('http://localhost/admin');
await response.assertOk();See @tyravel/admin in the package reference.