AutoDisableExpireUserJob.php 592 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use App\Http\Models\User;
  5. use Log;
  6. class autoDisableExpireUserJob extends Command
  7. {
  8. protected $signature = 'autoDisableExpireUserJob';
  9. protected $description = '自动禁用到期用户';
  10. public function __construct()
  11. {
  12. parent::__construct();
  13. }
  14. public function handle()
  15. {
  16. // 到期账号禁用
  17. User::query()->where('enable', 1)->where('expire_time', '<=', date('Y-m-d'))->update(['enable' => 0]);
  18. Log::info('定时任务:' . $this->description);
  19. }
  20. }