codersvn / activity_logger
该软件包最新版本(1.0.0)的许可证信息不可用。
Vicoders Activity Logger
1.0.0
2019-01-10 07:54 UTC
This package is not auto-updated.
Last update: 2024-09-28 10:01:43 UTC
README
安装
该软件包设置非常简单,只有几个步骤。
Composer
composer require codersvn/laravel_activity_log
服务提供者
将软件包添加到您的应用服务提供者在 config/app.php
文件中。
'providers' => [ /* * Laravel Framework Service Providers... */ Illuminate\Foundation\Providers\ArtisanServiceProvider::class, Illuminate\Auth\AuthServiceProvider::class, ... /** * Third Party Service Providers... */ Vicoders\ActivityLog\Providers\ActivityLogServiceProvider::class, ],
迁移文件
发布软件包配置文件和迁移到您的应用。请在您的终端运行以下命令。
php artisan vendor:publish --provider="Vicoders\ActivityLog\Providers\ActivityLogServiceProvider" --tag=migrations
并运行迁移。
php artisan migrate
这使用的是Laravel中的默认用户表。您应该已经有用户表的迁移文件,并且已迁移。
ActivityLogable 合同
<?php namespace VCComponent\Laravel\User\Events; use Illuminate\Queue\SerializesModels; use Vicoders\ActivityLog\Contracts\ActivityLogable; class UserRegisteredEvent implements ActivityLogable { use SerializesModels; public $user; /** * Create a new event instance. * * @return void */ public function __construct($user) { $this->user = $user; } public function getMeta() { return $this->user->id; }; public function getMetaType() { return 'user_id'; }; }
就是这样!