feat: Add tenant code to value changes; implement PurchaseController and related services for tenant-specific purchase management
This commit is contained in:
@@ -11,6 +11,8 @@ use LogicException;
|
||||
|
||||
trait LogsValueChanges
|
||||
{
|
||||
abstract protected function valueChangeTenantCode(): string;
|
||||
|
||||
public static function bootLogsValueChanges(): void
|
||||
{
|
||||
static::updated(function (Model $model): void {
|
||||
@@ -30,6 +32,7 @@ trait LogsValueChanges
|
||||
|
||||
foreach ($changedAttributes as $attribute) {
|
||||
$model->valueChanges()->create([
|
||||
'tenant_code' => $model->valueChangeTenantCode(),
|
||||
'attribute' => $attribute,
|
||||
'old_value' => $model->getRawOriginal($attribute),
|
||||
'new_value' => $model->getAttributes()[$attribute] ?? null,
|
||||
|
||||
Reference in New Issue
Block a user