Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
- Move the cache clear and change the created at
  • Loading branch information
deanblackborough committed Jun 24, 2023
1 parent 5aeba05 commit 0cc6f84
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions app/Jobs/MigrateBudgetItemsToBudgetPro.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function handle()
$budget_pro_model->end_date = $item->end_date;
$budget_pro_model->disabled = $item->disabled;
$budget_pro_model->frequency = $item->frequency;
$budget_pro_model->created_at = 'NOW()';
$budget_pro_model->created_at = $item_model->created_at;
$budget_pro_model->save();
}

Expand All @@ -134,20 +134,20 @@ public function handle()
$resource->data = $budget_resource_data;
$resource->save();
}

$cache_clear_payload = (new \App\Cache\JobPayload())
->setGroupKey(\App\Cache\KeyGroup::RESOURCE_DELETE)
->setRouteParameters([
'resource_type_id' => $budget_pro_resource_type_id,
'resource_id' => $budget_pro_resource_id
])
->setUserId($this->user_id);

ClearCache::dispatchSync($cache_clear_payload->payload());
});
} catch (\Exception) {
$this->fail(new \Exception('Failed to create all the items or save the resource data'));
}

$cache_clear_payload = (new \App\Cache\JobPayload())
->setGroupKey(\App\Cache\KeyGroup::RESOURCE_DELETE)
->setRouteParameters([
'resource_type_id' => $budget_pro_resource_type_id,
'resource_id' => $budget_pro_resource_id
])
->setUserId($this->user_id);

ClearCache::dispatchSync($cache_clear_payload->payload());
}

public function fetchBudgetItems(int $resource_id): array
Expand Down

0 comments on commit 0cc6f84

Please sign in to comment.