Skip to content

Commit 55933da

Browse files
committed
touch content
1 parent 7325aab commit 55933da

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/Actions/SyncBlocksAction.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public static function create(Content $content): self
2020

2121
/**
2222
* @param Collection<array-key, Block> $blocks
23+
* @return array{created: array, deleted: array, updated: array}
2324
*/
2425
public function execute(Collection $blocks): array
2526
{

src/Traits/HasBlocks.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public function blocks(): HasMany
2222

2323
/**
2424
* @param CollectionSupport<array-key, Block> $blocks
25+
* @return array{created: array, deleted: array, updated: array}
2526
*/
2627
public function syncBlocks(CollectionSupport $blocks): array
2728
{

src/Traits/HasContents.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,16 @@ public function updateContent(array $attributes = [], CollectionSupport $blocks,
6161
{
6262
$content ??= $this->content;
6363

64-
$content->syncBlocks($blocks);
64+
$syncs = $content->syncBlocks($blocks);
6565

6666
$content->duration = Config::getDurationCalculator($content)->calculate();
6767

68+
if (count($syncs['created']) || count($syncs['deleted']) || count($syncs['updated'])) {
69+
if ($content->usesTimestamps()) {
70+
$content->updateTimestamps();
71+
}
72+
}
73+
6874
return $content->fill($attributes)->save();
6975
}
7076
}

0 commit comments

Comments
 (0)