Blame view

app/Console/Commands/DeleteExpiredAutoliftOptions.php 787 Bytes
ab181e741   Fedor   task-132985 autol...
1
2
3
4
5
  <?php
  
  namespace App\Console\Commands;
  
  use App\Models\EmployerAutoliftOption;
8ec6b4403   Fedor   task-132985 autor...
6
  use App\Models\WorkerAutoliftOption;
ab181e741   Fedor   task-132985 autol...
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  use Illuminate\Console\Command;
  
  class DeleteExpiredAutoliftOptions extends Command
  {
      protected $signature = 'vacancy:delete_expired';
  
      protected $description = 'Command description';
  
      public function handle()
      {
          EmployerAutoliftOption::query()
              ->whereRaw('`updated_at` < DATE_SUB(NOW(), INTERVAL `days_repeat` DAY)')
              ->update([
                  'is_enabled' => false
              ]);
8ec6b4403   Fedor   task-132985 autor...
22
23
24
25
26
          WorkerAutoliftOption::query()
              ->whereRaw('`updated_at` < DATE_SUB(NOW(), INTERVAL `days_repeat` DAY)')
              ->update([
                  'is_enabled' => false
              ]);
ab181e741   Fedor   task-132985 autol...
27
28
29
          return Command::SUCCESS;
      }
  }