1. Go to this page and download the library: Download bgeneto/ci4-audits 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/ */
bgeneto / ci4-audits example snippets
use Bgeneto\Audits\Traits\AuditsTrait;
class JobModel extends Model
{
use AuditsTrait;
// Configure event auditing callbacks by using either the class constructor or the model's initialize() method.
protected function initialize(): void
{
parent::initialize();
$this->setAuditsCallbacks(['afterInsert', 'afterUpdate', 'afterDelete']);
}
use Bgeneto\Audits\Traits\AuditsTrait;
class JobModel extends Model
{
use AuditsTrait;
public function __construct()
{
parent::__construct();
$this->setAuditsCallbacks(['afterInsert', 'afterUpdate', 'afterDelete']);
}
use Bgeneto\Audits\Audits;
$formData = [
'name' => 'John Doe'
];
Audits::logEvent($formData, "Profile data changed");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.