İlk temizlik tamamlandı bir önceki projeden
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Shared NDT Log Trigger Logic
|
||||
*
|
||||
* This file is included by individual NDT log save triggers to
|
||||
* invalidate the 'request-ndt' cache when 'control_standart' changes.
|
||||
*/
|
||||
|
||||
$shouldUpdate = false;
|
||||
|
||||
// If we have data and it has control_standart
|
||||
if(isset($data) && property_exists($data, 'control_standart')) {
|
||||
// If it's a new record (no beforeData) or if the value changed
|
||||
// We also check if beforeData has the property, just in case
|
||||
if(!isset($beforeData) || !property_exists($beforeData, 'control_standart') || $data->control_standart != $beforeData->control_standart) {
|
||||
$shouldUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if($shouldUpdate) {
|
||||
if(function_exists('dispatchCacheBladeViews')) {
|
||||
dispatchCacheBladeViews([
|
||||
[
|
||||
'view' => 'admin-ajax.request-ndt-no-cache',
|
||||
'cache' => 'request-ndt'
|
||||
],
|
||||
[
|
||||
'view' => 'admin-ajax.ndt-calculation-no-cache',
|
||||
'cache' => 'ndt-calculation'
|
||||
],
|
||||
[
|
||||
'view' => 'admin-ajax.ndt-order.order-list-no-cache',
|
||||
'cache' => 'ndt-order-list'
|
||||
]
|
||||
]);
|
||||
|
||||
Log::info("NDT Log triggered request-ndt cache update due to control_standart change.", [
|
||||
'table' => $tableName ?? 'unknown',
|
||||
'id' => $data->id ?? 'unknown',
|
||||
'new_value' => $data->control_standart ?? 'null',
|
||||
'old_value' => $beforeData->control_standart ?? 'null'
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user