Blame view
app/Console/Commands/DispatchVacancyLiftJobCommand.php
1.46 KB
ab181e741 task-132985 autol... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?php namespace App\Console\Commands; use App\Jobs\LiftVacancyJob; use App\Jobs\SendVacancyToTelegramJob; use App\Models\EmployerAutoliftOption; use Illuminate\Console\Command; class DispatchVacancyLiftJobCommand extends Command { protected $signature ='vacancy:dispatch'; public function handle() { |
8ec6b4403 task-132985 autor... |
16 |
$now = now()->timezone('Europe/Moscow')->format('H:i'); |
ab181e741 task-132985 autol... |
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
$employers = EmployerAutoliftOption::query() ->where(function ($query) use ($now) { $query->where('times_per_day', 1) ->where('time_send_first', $now); }) ->orWhere(function ($query) use ($now) { $query->where('times_per_day', 2) ->where('time_send_first', $now) ->where('time_send_second', $now); }) ->orWhere(function ($query) use ($now) { $query->where('times_per_day', 3) ->where('time_send_first', $now) ->where('time_send_second', $now) ->where('time_send_third', $now); }) ->orWhere('time_send_tg', $now) ->get(); LiftVacancyJob::dispatch( $employers->whereNotNull('time_send_first')->pluck('employer_id')->toArray(), ); SendVacancyToTelegramJob::dispatch( $employers->whereNotNull('time_send_tg')->pluck('employer_id')->toArray() ); return Command::SUCCESS; } } |