Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orisintel/laravel-process-stamps
Logs which process created or modified a record
https://github.com/orisintel/laravel-process-stamps
database hacktoberfest laravel logging php php7
Last synced: 3 months ago
JSON representation
Logs which process created or modified a record
- Host: GitHub
- URL: https://github.com/orisintel/laravel-process-stamps
- Owner: orisintel
- License: mit
- Created: 2018-09-04T14:14:07.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-10T15:09:13.000Z (over 2 years ago)
- Last Synced: 2024-07-19T03:49:27.359Z (4 months ago)
- Topics: database, hacktoberfest, laravel, logging, php, php7
- Language: PHP
- Homepage:
- Size: 84 KB
- Stars: 96
- Watchers: 16
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Laravel Process Stamps
[![Latest Version on Packagist](https://img.shields.io/packagist/v/orisintel/laravel-process-stamps.svg?style=flat-square)](https://packagist.org/packages/orisintel/laravel-process-stamps)
[![Build Status](https://img.shields.io/github/workflow/status/orisintel/laravel-process-stamps/tests?style=flat-square)](https://github.com/orisintel/laravel-process-stamps/actions?query=workflow%3Atests)
[![Total Downloads](https://img.shields.io/packagist/dt/orisintel/laravel-process-stamps.svg?style=flat-square)](https://packagist.org/packages/orisintel/laravel-process-stamps)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:
```bash
composer require orisintel/laravel-process-stamps
```## Configuration
``` php
php artisan vendor:publish --provider="\OrisIntel\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.
``` php
// User model
class User extends Model
{
use ProcessStampable;```
Next, create a migration for your table and include the following:
```php
$table->processIds();
```To specify your own foreign key or index names, include the following options:
```php
$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
``` bash
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:
```bash
docker-compose build
```Then you can bring it up in the background using:
```bash
docker-compose up -d
```And the image is aliased so you can access its command line via:
```bash
docker exec -it processes-stamp-app /bin/bash
```From there you can run the tests within an isolated environment
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
### Security
If you discover any security related issues, please email [[email protected]](mailto:[email protected]) instead of using the issue tracker.
## Credits
- [Tom Schlick](https://github.com/tomschlick)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.