Skip to content

An Implementation of laravel auditing for laravel nova

Notifications You must be signed in to change notification settings

yassir3wad/nova-auditing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Nova Auditing

This package provides an implementation of laravel auditing for Nova

Features

  • 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.

Installation

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

Usage

  1. 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
    ]
];
  1. 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)
         ];
     }   
}

About

An Implementation of laravel auditing for laravel nova

Resources

Stars

Watchers

Forks

Packages

No packages published