Skip to content

Commit 0f58978

Browse files
committed
feat: allow for overriding the distribution id inside the job
1 parent 2981178 commit 0f58978

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

config/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
/**
2121
* Specify the CloudFront Distribution ID.
22-
* Example format: EBCYQAQALNSKL.
22+
* Example format: EBCYQAQALNSKL
2323
*/
2424
'distribution_id' => env('AWS_CLOUDFRONT_DISTRIBUTION_ID'),
2525

src/Jobs/InvalidateCache.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@ class InvalidateCache implements ShouldQueue
1515

1616
private $paths;
1717

18+
private $distributionId;
19+
1820
/**
1921
* Create a new job instance.
2022
*
2123
* @param string|array $paths
2224
*/
23-
public function __construct($paths)
25+
public function __construct($paths, $distributionId = null)
2426
{
2527
$this->paths = $paths;
28+
$this->distributionId = $distributionId;
2629
}
2730

2831
/**
@@ -32,6 +35,6 @@ public function __construct($paths)
3235
*/
3336
public function handle()
3437
{
35-
CloudFront::invalidate($this->paths);
38+
CloudFront::invalidate($this->paths, $this->distributionId);
3639
}
3740
}

0 commit comments

Comments
 (0)