Files
jobifygarden/app/Console/Commands/EnrichJobs.php
T

46 lines
1.3 KiB
PHP

<?php
namespace App\Console\Commands;
use App\Services\JobEnrichmentService;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
#[Signature('jobs:enrich {--batch=100}')]
#[Description('Enrich job listings with additional data (categories, experience levels, etc.)')]
class EnrichJobs extends Command
{
protected $signature = 'jobs:enrich {--batch=100}';
protected $description = 'Enrich job listings with additional data';
public function __construct(
private JobEnrichmentService $enrichmentService
) {
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle(): int
{
$batchSize = (int) $this->option('batch');
$log = Log::channel('jobs_enrich');
$log->info('Starting job enrichment', ['batch_size' => $batchSize]);
$this->info('Enriching job listings...');
$this->newLine();
$enrichedCount = $this->enrichmentService->enrichJobs($batchSize);
$this->newLine();
$this->info("Enriched {$enrichedCount} jobs successfully!");
$log->info('Enrichment complete', ['enriched' => $enrichedCount]);
return self::SUCCESS;
}
}