Skip to content

Commit

Permalink
Fix the way we pass around creds so we stop using hard coded numbers....
Browse files Browse the repository at this point in the history
  • Loading branch information
austinkregel committed Jan 1, 2024
1 parent 6419f0d commit b224f73
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/Jobs/CloudflareSyncAndPurgeJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function handle(DomainServiceFactory $serviceFactory)
public function sync(): void
{
$page = 1;
$registrarService = (new RegistrarServiceFactory)->make(Credential::find(2));
$registrarService = (new RegistrarServiceFactory)->make($this->credential);

do {
$domains = $this->service->getDomains(100, $page++);
Expand Down
12 changes: 8 additions & 4 deletions app/Jobs/FetchCloudflareAnalytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ class FetchCloudflareAnalytics implements ShouldQueue

public function handle()
{
$service = new \App\Services\Domain\CloudflareDomainService(Credential::find(4));
$domains = \App\Models\Domain::whereNotNull('cloudflare_id')->get();
$services = Credential::where('service', 'cloudflare')->get();

foreach ($domains as $domain) {
$service->getAnalytics($domain, now()->subDay()->startOfDay(), now()->endOfDay());
foreach ($services as $service) {
$service = new \App\Services\Domain\CloudflareDomainService($service);
$domains = \App\Models\Domain::whereNotNull('cloudflare_id')->get();

foreach ($domains as $domain) {
$service->getAnalytics($domain, now()->subDay()->startOfDay(), now()->endOfDay());
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public function up(): void
\App\Models\Navigation::create([
'name' => 'Banking',
'icon' => 'WalletIcon',
'href' => '/-/',
'href' => '/-/banking',
'order' => 6,
'authentication_required' => true,
]);
\App\Models\Navigation::create([
'name' => 'Tags',
'icon' => 'TagIcon',
'href' => '/-/',
'href' => '/-/tag-manager',
'order' => 8,
'authentication_required' => true,
]);
Expand Down

0 comments on commit b224f73

Please sign in to comment.