Files
panel/app/Console/Commands/Server/ResetUsagesCommand.php
2023-04-28 06:51:12 +00:00

32 lines
613 B
PHP

<?php
namespace Convoy\Console\Commands\Server;
use Convoy\Models\Server;
use Illuminate\Console\Command;
class ResetUsagesCommand extends Command
{
/**
* @var string
*/
protected $description = 'Reset the bandwidth usage of all servers on the first of each month.';
/**
* @var string
*/
protected $signature = 'c:server:reset-usages';
/**
* Handle command execution.
*/
public function handle(): void
{
if (date('d') === '01') {
Server::query()->update([
'bandwidth_usage' => 0,
]);
}
}
}