seinoxygen/audit-viewer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

seinoxygen/audit-viewer

最新稳定版本:v1.0.1

Composer 安装命令:

composer require seinoxygen/audit-viewer

包简介

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

README 文档

README

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.

统计信息

  • 总下载量: 170
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-20