This package provides an implementation of laravel auditing for Nova
- Display all audit resources for a specified resource.
- Display an audit details, and specify where the changes happened.
- Revert a model into a specified audit.
composer require yassir3wad/nova-auditing
First of all, follow the installation guide of the parent package, then publish the config file
php artisan vendor:publish --provider="Yassir3wad\NovaAuditing\ToolServiceProvider" --tag=config
- Add your auditable resources and user resources into the published config file
novaaudit.php
<?php
return [
'auditable_resources' => [
App\Nova\Post::class,
],
'user_resources' => [
App\Nova\User::class
]
];
- Add
Audits
MorphMany
relation into your resource to list resource audits
<?php
use Laravel\Nova\Fields\MorphMany;
use Yassir3wad\NovaAuditing\Resources\Audit;
class Post extends Resource{
public function fields(Request $request)
{
return [
ID::make()->sortable(),
MorphMany::make('Audits', 'audits', Audit::class)
];
}
}