30 lines
724 B
PHP
30 lines
724 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Esun\CustomerMessage\ViewModel;
|
|
|
|
use Esun\CustomerMessage\Model\ConversationService;
|
|
use Magento\Customer\Model\Session;
|
|
use Magento\Framework\View\Element\Block\ArgumentInterface;
|
|
|
|
class OrderUnread implements ArgumentInterface
|
|
{
|
|
public function __construct(
|
|
private readonly Session $session,
|
|
private readonly ConversationService $conversations
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* @param int[] $orderIds
|
|
* @return array<int, int>
|
|
*/
|
|
public function getUnreadCounts(array $orderIds): array
|
|
{
|
|
return $this->conversations->getCustomerUnreadByOrderIds(
|
|
(int)$this->session->getCustomerId(),
|
|
$orderIds
|
|
);
|
|
}
|
|
}
|