PHP code example of cboxdk / laravel-audit-chain

1. Go to this page and download the library: Download cboxdk/laravel-audit-chain 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/ */

    

cboxdk / laravel-audit-chain example snippets


use Cbox\AuditChain\Contracts\AuditChain;
use Cbox\AuditChain\ValueObjects\ChainActor;
use Cbox\AuditChain\ValueObjects\ChainEvent;
use Cbox\AuditChain\ValueObjects\ChainKey;

$chain = app(AuditChain::class);
$key = ChainKey::of($tenant->id, 'billing');

$chain->record($key, ChainEvent::by(ChainActor::of('user', $user->id), 'invoice.voided')->on('invoice', $invoice->id));

$chain->verify($key)->valid;   // false if anything recorded was changed, removed or reordered
$chain->checkpoint($key);      // sign the head, so truncation becomes detectable too
bash
composer vendor:publish --tag=audit-chain-config
php artisan vendor:publish --tag=audit-chain-migrations
php artisan migrate
php artisan audit-chain:keygen