cotizaweb/app/Helpers/audit.php
jesusfb 161fcee049
Some checks are pending
Deploy to EC2 cotiza / deploy (push) Waiting to run
first commit
2026-04-24 12:53:27 -07:00

27 lines
625 B
PHP

<?php
use App\Models\Audit;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Request;
function audit_log(
$event,
$module,
$model = null,
$old = null,
$new = null
) {
Audit::create([
'event' => $event,
'module' => $module,
'auditable_type' => $model ? get_class($model) : null,
'auditable_id' => $model?->id,
'user_id' => Auth::id(),
'company_id' => Auth::user()?->company_id,
'old_values' => $old,
'new_values' => $new,
'ip_address' => Request::ip(),
'user_agent' => Request::userAgent(),
]);
}