weblynx/laravel-model-audit is a Laravel package for audit package for laravel models.
It currently has 0 GitHub stars and 1 downloads on Packagist.
Install it with composer require weblynx/laravel-model-audit.
Discover more Laravel packages by weblynx
or browse all Laravel packages to compare alternatives.
Last updated
composer require weblynx/laravel-model-audit
php artisan migrate
php artisan vendor:publish
<?php
return [
'options' => [
'created',
'updated',
// 'deleted',
'restored',
'soft-deleted',
'force-deleted'
]
];
protected array $excludedAudits = [
'created'
];
WithAuditor is used to activate th events of the package. Use it on model you want to be audited.
class Model {
use WithAuditor;
}
HasManyAudits returns a hasMany relationship on the model that has created models.
class Model {
use HasManyAudits;
}
class Auditor
Auditor class has a dynamic belongsToRelationship based on the provider defined in config. Ex:
Will return a belongsTo relationship with the name: user().
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
],
Next steps: