ahuseiny/laravel-userstamps
最新稳定版本:v3.0.3
Composer 安装命令:
composer require ahuseiny/laravel-userstamps
包简介
A simple Laravel package for Eloquent Model user specific fields.
README 文档
README
Laravel Userstamps is a simple Laravel package for your Eloquent Model user specific fields. This package automatically inserts/updates an user id on your table on who created, last updated and deleted the record.
Install
- Add repositories in composer.json
"repositories": [
{
"url": "https://github.com/hrshadhin/laravel-userstamps.git",
"type": "git"
}
],
- Add the package name in
composer.jsonrequire section:- For Laravel 5.x use v1.0.1
"hrshadhin/laravel-userstamps": "^1.0.0"- For Laravel 6.x use
masteror v2.0.1
"hrshadhin/laravel-userstamps": "^2.0.0"- For Laravel 7.x use
masteror v3.0.0
"hrshadhin/laravel-userstamps": "^3.0.0"
Usage
Update your model's migration and add created_by, updated_by and deleted_by field using the userstamps() blueprint macro.
Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name', 100); $table->userstamps(); $table->timestamps(); });
Then use UserstampsTrait on your model.
namespace App; use Hrshadhin\Userstamps\UserstampsTrait; class User extends Model { use UserstampsTrait; }
Dropping columns
You can drop auditable columns using dropUserstamps() method.
Schema::create('users', function (Blueprint $table) { $table->dropUserstamps(); });
And your done!
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 50
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-03-13