Commit ef7860c0 authored by Administrator's avatar Administrator

Update 2 files via Son of Anton

parent 3be93f73
......@@ -12,6 +12,7 @@ abstract class Model
protected static bool $softDelete = true;
protected static bool $dispatchEvents = true;
protected static bool $auditEnabled = true;
protected static bool $autoTrackAuthor = true;
protected array $attributes = [];
protected bool $exists = false;
......@@ -65,9 +66,11 @@ abstract class Model
$filtered['updated_at'] = date('Y-m-d H:i:s');
}
$employee = App::getInstance()->currentEmployee();
if ($employee) {
$filtered['created_by'] = $employee->id ?? ($employee['id'] ?? null);
if (static::$autoTrackAuthor) {
$employee = App::getInstance()->currentEmployee();
if ($employee) {
$filtered['created_by'] = $employee->id ?? ($employee['id'] ?? null);
}
}
$db = App::getInstance()->db();
......@@ -110,9 +113,11 @@ abstract class Model
$filtered['updated_at'] = date('Y-m-d H:i:s');
}
$employee = App::getInstance()->currentEmployee();
if ($employee) {
$filtered['updated_by'] = $employee->id ?? ($employee['id'] ?? null);
if (static::$autoTrackAuthor) {
$employee = App::getInstance()->currentEmployee();
if ($employee) {
$filtered['updated_by'] = $employee->id ?? ($employee['id'] ?? null);
}
}
$db = App::getInstance()->db();
......
......@@ -14,6 +14,7 @@ class Document extends Model
protected static bool $timestamps = true;
protected static bool $softDelete = true;
protected static bool $dispatchEvents = true;
protected static bool $autoTrackAuthor = false;
protected static array $fillable = [
'member_id', 'document_type', 'original_filename', 'stored_filename',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment