承接 mintbridge/eloquent-auditing 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mintbridge/eloquent-auditing

最新稳定版本:v0.0.5

Composer 安装命令:

composer require mintbridge/eloquent-auditing

包简介

An eloquent package for recording model events to a database

README 文档

README

This Laravel 5 package allows model events to be logged to a database. It provides a trait that can be added to any Eloquent model allowing for chosen events to be logged using a polymorphic relationship.

Installation

This package can be installed through Composer.

composer require mintbridge/eloquent-auditing

Once installed add the service provider and facade to your app config

// config/app.php

'providers' => [
    '...',
    Mintbridge\EloquentAuditing\AuditServiceProvider::class,
];

'aliases' => [
    ...
    'Auditor' => Mintbridge\EloquentAuditing\AuditorFacade::class,
];

You'll also need to publish and run the migration in order to create the database table.

php artisan vendor:publish --provider="Mintbridge\EloquentAuditing\AuditServiceProvider" --tag="config"
php artisan vendor:publish --provider="Mintbridge\EloquentAuditing\AuditServiceProvider" --tag="migrations"
php artisan migrate

The configuration will be written to config/auditing.php. The options have sensible defaults but you should change the user to match the one used in your application.

Usage

This package will record the events from your models. To do so your model must use the Auditable trait and implement AuditableInterface.

use Mintbridge\EloquentAuditing\Auditable;
use Mintbridge\EloquentAuditing\AuditableInterface;

class Article extends Eloquent implements AuditableInterface {

    use Auditable;
...

The trait by default will use the event in config/auditing.php but you can overide this on a per model basis by adding a static $auditableEvents array of event names to the model. See http://laravel.com/docs/5.1/eloquent#events for the available events.

use Mintbridge\EloquentAuditing\Auditable;
use Mintbridge\EloquentAuditing\AuditableInterface;

class Article extends Eloquent implements AuditableInterface {

    use Auditable;

    public static $auditableEvents = [
        'creating',
        'created',
        'updating',
        //...
    ];
...

Contributing

Please see CONTRIBUTING for details.

License

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

统计信息

  • 总下载量: 6.23k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-06