1. Go to this page and download the library: Download hypathbel/model-scribe 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/ */
use HypathBel\ModelScribe\Traits\HasAuditLog;
class Product extends Model
{
use HasAuditLog;
}
class Order extends Model
{
use HasAuditLog;
// Only log specific events
protected array $auditEvents = ['created', 'updated'];
// Limit which attributes are recorded per event
protected array $auditAttributes = [
'updated' => ['status', 'total_price', 'shipping_address'],
];
// Route to a specific store/table
protected string $auditLogName = 'orders';
// Add searchable tags to every log entry
protected array $auditTags = ['warehouse-A', 'priority-high'];
}
use HypathBel\ModelScribe\Facades\ModelScribe;
use HypathBel\ModelScribe\Enums\ScribeEvent;
ModelScribe::log(
event: ScribeEvent::Custom,
logName: 'system',
description: 'User initiated a bulk export',
properties: ['format' => 'csv', 'rows' => 1200],
tags: ['export']
);