38 lines
944 B
PHP
38 lines
944 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Console\Commands;
|
||
|
|
|
||
|
|
use App\Services\JobEnrichmentService;
|
||
|
|
use Illuminate\Console\Attributes\Description;
|
||
|
|
use Illuminate\Console\Attributes\Signature;
|
||
|
|
use Illuminate\Console\Command;
|
||
|
|
|
||
|
|
#[Signature('jobs:enrich {--batch=100}')]
|
||
|
|
#[Description('Enrich job listings with additional data (categories, experience levels, etc.)')]
|
||
|
|
class EnrichJobs extends Command
|
||
|
|
{
|
||
|
|
public function __construct(
|
||
|
|
private JobEnrichmentService $enrichmentService
|
||
|
|
) {
|
||
|
|
parent::__construct();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Execute the console command.
|
||
|
|
*/
|
||
|
|
public function handle(): int
|
||
|
|
{
|
||
|
|
$batchSize = (int) $this->option('batch');
|
||
|
|
|
||
|
|
$this->info('Enriching job listings...');
|
||
|
|
$this->newLine();
|
||
|
|
|
||
|
|
$enrichedCount = $this->enrichmentService->enrichJobs($batchSize);
|
||
|
|
|
||
|
|
$this->newLine();
|
||
|
|
$this->info("Enriched {$enrichedCount} jobs successfully!");
|
||
|
|
|
||
|
|
return self::SUCCESS;
|
||
|
|
}
|
||
|
|
}
|