always-open/laravel-process-stamps
最新稳定版本:v8.1.0
Composer 安装命令:
composer require always-open/laravel-process-stamps
包简介
Logs which process created or modified a record
README 文档
README
It is sometimes very useful to know which process created or modified a particular record in your database. This package provides a trait to add to your Laravel models which automatically logs that for you.
Installation
You can install the package via composer:
composer require always-open/laravel-process-stamps
Configuration
php artisan vendor:publish --provider="\AlwaysOpen\ProcessStamps\ProcessStampsServiceProvider"
Running the above command will publish both the migration and the config file.
Usage
After adding the proper fields to your table, add the trait to your model.
// User model class User extends Model { use ProcessStampable;
Next, create a migration for your table and include the following:
$table->processIds();
To specify your own foreign key or index names, include the following options:
$table->processIds([ 'created_index_name' => 'custom_created_index_name', 'updated_index_name' => 'custom_updated_index_name', 'created_foreign_key_name' => 'custom_created_foreign_key_name', 'updated_foreign_key_name' => 'custom_updated_foreign_key_name', ]);
That will generate the nessesary field names to track processes.
Testing
composer test
Using Docker
All assets are set up under the docker-compose.yml file. The first time you run the docker image you must build it with the following command:
docker-compose build
Then you can bring it up in the background using:
docker-compose up -d
And the image is aliased so you can access its command line via:
docker exec -it processes-stamp-app /bin/bash
From there you can run the tests within an isolated environment
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email @tomschlick or @qschmick directly instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 22.27k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-06-15