Skip to content

Commit

Permalink
feat: allow for overriding the distribution id inside the job
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Feb 12, 2021
1 parent 2981178 commit 0f58978
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/**
* Specify the CloudFront Distribution ID.
* Example format: EBCYQAQALNSKL.
* Example format: EBCYQAQALNSKL
*/
'distribution_id' => env('AWS_CLOUDFRONT_DISTRIBUTION_ID'),

Expand Down
7 changes: 5 additions & 2 deletions src/Jobs/InvalidateCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ class InvalidateCache implements ShouldQueue

private $paths;

private $distributionId;

/**
* Create a new job instance.
*
* @param string|array $paths
*/
public function __construct($paths)
public function __construct($paths, $distributionId = null)
{
$this->paths = $paths;
$this->distributionId = $distributionId;
}

/**
Expand All @@ -32,6 +35,6 @@ public function __construct($paths)
*/
public function handle()
{
CloudFront::invalidate($this->paths);
CloudFront::invalidate($this->paths, $this->distributionId);
}
}

0 comments on commit 0f58978

Please sign in to comment.