HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: /home/xedaptot/ai.naniguide.com/app/Notifications/Admin/RenewOrdersBatch.php
<?php

namespace App\Notifications\Admin;

use App\Notifications\AppNotification;

/**
 * Aggregate notification: N renewal orders were created in a single cron run.
 * Shared with admins so they have visibility into auto-renew throughput
 * without flooding the inbox with one row per renew order.
 *
 * Group key carries the cron tick stamp so each hour's batch produces its
 * own row (no collapse across runs).
 */
class RenewOrdersBatch extends AppNotification
{
    public function __construct(public int $count, public string $stamp) {}

    public function audience(): string { return self::AUDIENCE_ADMINS; }
    public function category(): string { return self::CATEGORY_INFO; }
    public function severity(): string { return self::SEVERITY_INFO; }

    public function groupKey(): string
    {
        return 'renew-orders-batch:' . $this->stamp;
    }

    public function toArray(object $notifiable = null): array
    {
        return [
            'title' => trans('refactor/notifications.renew_orders_batch.title'),
            'body'  => trans('refactor/notifications.renew_orders_batch.body', [
                'count' => $this->count,
            ]),
            'action' => [
                'label'  => trans('refactor/notifications.renew_orders_batch.cta'),
                'route'  => 'refactor.admin.subscriptions.index',
                'params' => [],
            ],
        ];
    }
}