Skip to content

A simple audit viewer for the package owen-it/laravel-auditing.

License

Notifications You must be signed in to change notification settings

seinoxygen/audit-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Audit Viewer

Donate Packagist Downloads

A simple audit viewer viewer for the package owen-it/laravel-auditing.

Installation

Add Audit Viewer as a dependency using the composer CLI:

composer require seinoxygen/audit-viewer

Publishing Assets

php artisan vendor:publish --provider="SeinOxygen\AuditViewer\AuditViewerServiceProvider" --tag=config

php artisan vendor:publish --provider="SeinOxygen\AuditViewer\AuditViewerServiceProvider" --tag=views

php artisan vendor:publish --provider="SeinOxygen\AuditViewer\AuditViewerServiceProvider" --tag=view-components

php artisan vendor:publish --provider="SeinOxygen\AuditViewer\AuditViewerServiceProvider" --tag=translations

Basic Usage

If using < Laravel 5.5, add the AuditViewerServiceProvider to the providers array

'providers' => [
    ...
    SeinOxygen\AuditViewer\AuditViewerServiceProvider::class,
    ...
],

Using your-url.com/audit-viewer you can have access to all audits saved on your database.

Controllers

In your controller you'll need to add the AuditViewContract and the trait HasAudits.

Also you'll need to return the auditable model in the function setModel().

<?php

namespace App\Http\Controllers;

use App\Models\Blog;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use SeinOxygen\AuditViewer\Contracts\AuditViewContract;
use SeinOxygen\AuditViewer\Http\Traits\HasAudits;

class BlogController extends Controller implements AuditViewContract
{
    use HasAudits;

    public function setModel()
    {
        return Blog::class;
    }
}

The trait automatically will add a function called audit($id) to the controller and you'll need to add that route manually to access all models audit.

Routing

You'll need to add routes manually to your controllers.

<?php

use App\Http\Controllers\BlogController;
use Illuminate\Support\Facades\Route;

Route::get('/blog/{model}/audit', [BlogController::class, 'audit']);

License

The MIT License (MIT). Please see License File for more information.

About

A simple audit viewer for the package owen-it/laravel-auditing.

Resources

License

Stars

Watchers

Forks

Packages

No packages published