Download the PHP package geeky/historical-model without Composer
On this page you can find all versions of the php package geeky/historical-model. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download geeky/historical-model
More information about geeky/historical-model
Files in geeky/historical-model
Package historical-model
Short Description This package is to make a historical model for any model you want very easy and very quickly.
License MIT
Informations about the package historical-model
Historical Model
Installation
Install using composer:
composer require geeky/historical-model --dev
About
This package created for helping you to create a historical model/data for any model/data you want, so one of the solutions of creating a historical data os by creating a history table for the basic table, so if we have a table called employees with this columns:
and we want to make save our data in another place in case if the employee changes his address or his salary for example, like if the salary of an employee is 500$ then he updated the salary to be 1000$ then 1500$ so we want to save all of these data to have a historical data to know when the employee was 1000$ or something else, Our history table schema will be:
Usage
you can create the historical model/data just by a very easy command
php artisan make:history-model
then you will be asked what model you want to make it historical,
and the package will automatically get your columns and ask you column column with y/n if you to log it, and hola you will get your model and your migration file ready to migrate.
Important
You should use the
Geeky\Historical\Concerns\Historical
trait file in your base model
Todo List
- [ ] Add a command to sync the base data from the base table to the historical table
- [ ] Add the trait automatically to the base model
- [x] Remove the timestamps() from the migration file