{"repo":"seancheung/history","free":true,"listed":false,"github":"https://github.com/seancheung/history","clone":"git clone https://github.com/seancheung/history.git","description":"Eloquent model history tracking for Laravel","language":"PHP","stars":164,"topics":["laravel","history","tracking","logs","behaviours","model-history"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"History Eloquent model history tracking for Laravel Installation Composer Laravel 6.x and above (tested up to Laravel 13.x) Laravel 5.6.x Service provider and alias Only required for Laravel 5.6.x config/app.php Migration Config Localization Usage Add HasOperations trait to user model that performs operations. Add HasHistories trait to the model that will be tracked. Remember that you'll need to implement the abstract getModelLabel method from the trait. This provides the model instance's display name in histories (as Who in Who did what ). Get histories of a model Get operations of a user Additional query conditions Both histories and operations return Eloquent relationships which also serve as query builders. You can add further constraints by chaining conditions: History Example message Example meta Custom history Besides the built in created/updating/deleting/restored events, you may track custom history record by firing an ModelChanged event. The ModelChanged constructor accepts two/three/four arguments. The first is the associated model instance; the second is the message; the third is optional, which is the meta(array); the fourth is also optional, being the translation key of the event(see Localization). Localization You may localize the model's type name. To do that, add the language line to the models array in the published language file, with the key being the class's base name in snake case . Example language config This will translate your model history into You ","default_branch":null,"files":null,"tree":[],"storefront":"/r/seancheung","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/seancheung/history/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}