-1
I need to log all changes, insertion and removal operations.
So far I did some tests, capturing the name of the fields in the forms that had their values changed (this for editing cases).
I am registering everything in the following table:
CREATE TABLE operacoes_log (
id int(11) NOT NULL,
feito_por int(10) UNSIGNED NOT NULL,
tipo int(10) UNSIGNED NOT NULL,
relacao_correspondente int(10) UNSIGNED NOT NULL,
referencia_operacao_id int(10) UNSIGNED NOT NULL,
descricao text COLLATE utf8_unicode_ci NOT NULL,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
updated_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
);
For now, I’m managing to log operations, but the trickiest part is retrieving this information to generate a report. The system was built with Laravel 5.4.
I would like to know if there is any reference or approach to this type of implementation.
Andrei, can you explain what is complicated? You can’t read the table
operacoes_log
?– RFL
I’m actually having doubts about the implementation of this type of case, where I need to keep a history of operations and find a viable way to recover the records that are in this table and the records that reference this operation. As there are several tables that can have the records changed it is half impossible to make an "if" for each type.
– Andrei
Have a look at this https://spatie.be/docs/laravel-activitylog/v4/introduction If you use this, have a look at the recommended version for Laravel 5.4
– Marcos Xavier