1 | <?php |
||||
2 | |||||
3 | namespace App\Console\Commands; |
||||
4 | |||||
5 | use App\Jobs\ProcessResume; |
||||
6 | use App\Models\Candidate; |
||||
7 | use App\Models\Tenant; |
||||
8 | use App\Services\TenantManager; |
||||
9 | use Illuminate\Console\Command; |
||||
10 | use Symfony\Component\Console\Exception\RuntimeException; |
||||
11 | |||||
12 | class ExtractPhotos extends Command |
||||
13 | { |
||||
14 | /** |
||||
15 | * The name and signature of the console command. |
||||
16 | * |
||||
17 | * @var string |
||||
18 | */ |
||||
19 | protected $signature = 'photo:extract {tenantId}'; |
||||
20 | |||||
21 | /** |
||||
22 | * The console command description. |
||||
23 | * |
||||
24 | * @var string |
||||
25 | */ |
||||
26 | protected $description = 'Command description'; |
||||
27 | |||||
28 | protected $tenantManager; |
||||
29 | |||||
30 | /** |
||||
31 | * Create a new command instance. |
||||
32 | * |
||||
33 | * @param TenantManager $tenantManager |
||||
34 | */ |
||||
35 | public function __construct(TenantManager $tenantManager) |
||||
36 | { |
||||
37 | parent::__construct(); |
||||
38 | |||||
39 | $this->tenantManager = $tenantManager; |
||||
40 | } |
||||
41 | |||||
42 | /** |
||||
43 | * Execute the console command. |
||||
44 | * |
||||
45 | * @return mixed |
||||
46 | */ |
||||
47 | public function handle() |
||||
48 | { |
||||
49 | $tenantId = $this->argument('tenantId'); |
||||
50 | $tenant = Tenant::find($tenantId); |
||||
51 | |||||
52 | if (!$tenant) { |
||||
53 | throw new RuntimeException('Tenant with ID = '.$tenantId.' does not exist.'); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
54 | } |
||||
55 | |||||
56 | $this->tenantManager->setTenant($tenant); |
||||
57 | \DB::purge('tenant'); |
||||
58 | |||||
59 | $candidates = Candidate::whereNull('photo_extraction')->where('path_to_cv', '<>', '')->get(); |
||||
60 | |||||
61 | foreach ($candidates as $candidate) { |
||||
62 | $this->info('Parsing candidate id '.$candidate->id); |
||||
63 | ProcessResume::dispatchNow($candidate); |
||||
0 ignored issues
–
show
The function
App\Jobs\ProcessResume::dispatchNow() has been deprecated: Will be removed in a future Laravel version.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead. ![]() |
|||||
64 | gc_collect_cycles(); |
||||
65 | } |
||||
66 | } |
||||
67 | } |
||||
68 |