mercredi 27 avril 2016

How to track changes in the database and store it in a history log (Laravel 5.1)

I have hook to track changes in database. I used this hook in app/helpers.php. i want to know how to call this function and use this after insert, update and saving.

helpers.php

function loggerAuditing($model)
{
    $changes = array();
    foreach($model->getDirty() as $key => $value){
        $original = $model->getOriginal($key);
        $changes[$key] = [
            'old' => $original,
            'new' => $value,
        ];
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire