carlosrgzm/activity-log

在您的 Laravel 5 应用程序中注册所有用户信息

v1.0.10 2016-10-28 11:20 UTC

This package is not auto-updated.

Last update: 2024-09-26 01:16:14 UTC


README

在您的 Laravel 5 应用程序中注册所有用户信息。

Latest Stable Version Total Downloads Latest Unstable Version License

安装

  1. carlosrgzm/activity-log 添加到 composer.json

"carlosrgzm/activity-log": "1.0.*"

  1. 运行 composer update 以拉取最新版本。

  2. 现在打开 app/config/app.php 并将服务提供者添加到 providers 数组。

'providers' => array( Carlosrgzm\ActivityLog\ActivityLogServiceProvider::class, ),

  1. 在 app.php 部分添加别名。

'aliases' => array( 'ActivityLog' => Carlosrgzm\ActivityLog\Models\ActivityLog::class,, ),

配置

运行 php artisan vendor:publish 以在配置文件夹中生成迁移和配置文件。

用法

为了使用此包,您可以在模板中添加以下代码

$act = new ActivityLog;

$data = new ActivityLogData($action, $contentType, $contentId, $details, $userId);

$act->log($data);

ActivityLogData() 的所有参数都是可选的。如果您在 activitylog.php 配置文件中将 'auto_set_user_id' 设置为 true,则 'user_id' 将自动设置为当前用户。

您应该检查 config/activitylog.php 以确保所有参数都是正确的。