Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

ash-jc-allen/find-a-pr

82 stars
3 code files
View ash-jc-allen/find-a-pr on GitHub

app/Services/IssueService.php

Open in GitHub
use Illuminate\Support\Collection;
 
class IssueService
{
//
public function getAll(): Collection
{
return app(RepoService::class)->reposToCrawl()
->flatMap(fn (array $repo): array => $this->getIssuesForRepo($repo));
}
//
}

app/Services/RepoService.php

Open in GitHub
use Illuminate\Support\Collection;
 
class RepoService
{
public function reposToCrawl(): Collection
{
return collect(config('repos.repos'))
->flatMap(function (array $repoNames, string $owner): array {
return collect($repoNames)->map(function (string $repoName) use ($owner): array {
return [
'owner' => $owner,
'name' => $repoName,
];
})->all();
});
}
}

app/Console/Commands/PreloadRepoData.php

Open in GitHub
use App\Services\IssueService;
use Illuminate\Console\Command;
 
class PreloadRepoData extends Command
{
//
public function handle(): int
{
//
$issues = app(IssueService::class)->getAll();
//
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.