1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6namespace App\Console\Commands;
7
8use App\Models\Store\Product;
9use Illuminate\Console\Command;
10
11class StoreExpireProducts extends Command
12{
13 protected $signature = 'store:expire-products';
14
15 protected $description = 'Disables products that should no longer be available.';
16
17 public function handle()
18 {
19 $count = Product
20 ::where('enabled', true)
21 ->notAvailable()
22 ->update(['enabled' => false]);
23
24 $this->line("Disabled {$count} items.");
25 }
26}