This commit is contained in:
deploy-bot committed 2026-12-04 15:10:03 +00:00
commit 860182098c
277 files changed
+18338

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
<?php
namespace IriksIT\Manager\Console;
use Illuminate\Console\Command;
use IriksIT\Manager\Support\Costs\Ledger;
/**
* Prices the rows of the site's TOKENS.md that have no kept price yet and keeps the answer. Run after a deploy, so a release is priced once
* and the owner's screen never has to wait for a price source.
*/
class CostsPriceCommand extends Command
{
protected $signature = 'manager:costs-price';
protected $description = 'Ask the price source once what the rows of TOKENS.md cost that have no kept price yet, and keep the answer';
public function handle(Ledger $ledger): int
{
$items = $ledger->items();
$kept = count(array_filter($items, fn (array $item) => $item['priced_by'] === 'service'));
$fixed = count(array_filter($items, fn (array $item) => $item['priced_by'] === 'config'));
$open = count(array_filter($items, fn (array $item) => $item['tokens'] > 0 && $item['priced_by'] === null));
$this->info(count($items)." rows: {$kept} with a kept price, {$fixed} priced with the fixed rates, {$open} without a price.");
return self::SUCCESS;
}
}