aw3r1se/laravel-audit-moonshine
Composer 安装命令:
composer require aw3r1se/laravel-audit-moonshine
包简介
MoonShine admin-panel bridge for aw3r1se/laravel-audit-core
README 文档
README
MoonShine admin-panel bridge for
aw3r1se/laravel-audit-core. Reuses the same recording
engine so actions performed through the MoonShine admin panel land in the same
audit stream as your API.
Why a separate middleware
MoonShine fires many mutating requests that change nothing, and its env-based
single-admin auth has no database user id. AuditMoonShineActions therefore:
- dispatches only when the model layer actually recorded a change, and
- stamps a configurable admin actor id (
nullby default) instead of the request user.
Everything else — what gets recorded, how it is delivered — is inherited from the core package and its transport.
Install
composer require aw3r1se/laravel-audit-moonshine
This bridge ships no config file of its own. Its single setting is merged at
runtime into the core package's audit config under the moonshine key, so the
only config you ever publish is config/audit.php from the core package.
Usage
Register the middleware in your MoonShine config so it wraps every admin request:
// config/moonshine.php 'middleware' => [ // ...MoonShine defaults... \Aw3r1se\Audit\MoonShine\Http\Middleware\AuditMoonShineActions::class, ],
Make the MoonShine-managed models auditable exactly as in the core package
(implements Auditable + use InteractsWithAudit).
Distinguish admin actions on the read side by their route name
(moonshine.crud.*, moonshine.update-field.*), and substitute an admin
display name for the null actor there.
Configuration
The actor id lives under the audit.moonshine namespace. Set it with the
AUDIT_MOONSHINE_ACTOR_ID env var, or add a moonshine block to the published
config/audit.php:
// config/audit.php 'moonshine' => [ 'actor_id' => env('AUDIT_MOONSHINE_ACTOR_ID'), ],
| key | default | purpose |
|---|---|---|
audit.moonshine.actor_id |
null |
user id stamped on actions made through the admin panel |
Testing
composer install
composer test
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-04