Blame view

app/Console/Commands/DeleteExpiredAutoliftOptions.php 681 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
  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)')
97498a691   Fedor   task-132985 minor...
19
              ->delete();
8ec6b4403   Fedor   task-132985 autor...
20
21
          WorkerAutoliftOption::query()
              ->whereRaw('`updated_at` < DATE_SUB(NOW(), INTERVAL `days_repeat` DAY)')
97498a691   Fedor   task-132985 minor...
22
              ->delete();
ab181e741   Fedor   task-132985 autol...
23
24
25
          return Command::SUCCESS;
      }
  }