Looking to hire Laravel developers? Try LaraJobs

laravel-logged-values maintained by legalworks

Description
Ever needed to store simple values easily, that could change over time or even in the future? When Event Sourcing is just a bit too much?
Author
Last update
2020/11/17 20:56 (dev-master)
License
Downloads
6

Comments
comments powered by Disqus

legalworks/laravel-logged-values

Latest Version on Packagist Total Downloads License

Ever needed to store simple values easily, that could change over time or even in the future? When Event Sourcing is just a bit too much? This is for you... maybe.

Installation

Via Composer

$ composer require legalworks/laravel-logged-values

Usage

Add trait

use Legalworks\LoggedValues\HasLoggedValues;

class SomeModel extends Model{
    use HasLoggedValues;
    ...
}

Add any logged values

$someModel->logValue('pages', 500, [
    'effective_at' => now(), //optional, defaults to now()
    'description' => null, //optional
]);

Get logged values

$someModel->loggedValues; //all logged values
$someModel->groupedValues; //all values grouped by key
$someModel->pastValues;
$someModel->futureValues;

$someModel->getLatestValue('pages', '2020-10-27 12:00:00'); //get the latest value of the given key before given (optional) datetime

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

license. Please see the license file for more information.