PHP code example of dual / kronikl

1. Go to this page and download the library: Download dual/kronikl library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dual / kronikl example snippets




// ... other code here ... //

// Get a trail record (define your own conditions here)
$trail = Kronikl::where('user_id', $user->id)->where('action', 'update')->first();

// Decode the JSON
$result = json_decode($trail->record);

// Output the old and new values
echo "Old value: " . $result->name->old . "<br>";
echo "New value: " . $result->name->new;



return [
    /**
     * Specify which fields (columns) to discard in the log for data changes.
     *
     * For security purposes, "passsword" and "remember_token" are " => [
        "password",
        "remember_token",
        "created_at",
        "updated_at",
        "deleted_at",
        "banned_at"
    ]
];



namespace App;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The keys defined in this array is discared by Kronikl.
     *
     * @var array
     */
    public $discarded = [
        'password'
    ];
}
shell
php artisan vendor:publish --provider="Dual\Kronikl\KroniklServiceProvider"
shell
php artisan migrate