b374k
m1n1 1.01
Apache/2.4.41 (Ubuntu)
Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64
uid=33(www-data) gid=33(www-data) groups=33(www-data)
server ip : 62.171.164.128 | your ip : 127.0.0.1
safemode OFF
 >  / home / dev2.destoffenstraat.com / app / code / Trustpilot / Reviews / Helper /
Filename/home/dev2.destoffenstraat.com/app/code/Trustpilot/Reviews/Helper/Notifications.php
Size1.76 kb
Permissionrwxrwxrwx
Ownerroot : root
Create time17-Aug-2025 10:26
Last modified25-Feb-2022 04:42
Last accessed22-Aug-2025 20:03
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
<?php

namespace Trustpilot\Reviews\Helper;

use Magento\Framework\App\Helper\AbstractHelper;
use Magento\AdminNotification\Model\Inbox;

class Notifications extends AbstractHelper
{
protected $_inbox;

public function __construct(Inbox $inbox)
{
$this->_inbox = $inbox;
}

public function createAdminNotification($title, $desc, $url)
{
$this->_inbox->addCritical($title, $desc, $url);

return $this;
}

public function getNotificationsCollection($title, $desc)
{
$collection = $this->_inbox->getCollection();

$collection->getSelect()
->where('title like "%'.$title.'%" and description like "%'.$desc.'%"')
->where('is_read != 1')
->where('is_remove != 1');

return $collection;
}

public function getLatestMissingKeyNotification()
{
$collection = $this->getNotificationsCollection('Trustpilot', 'installation key');

$collection->getSelect()
->order('notification_id DESC')
->limit(1);

$items = array_values($collection->getItems());
return count($items) > 0 ? $items[0] : null;
}

public function createMissingKeyNotification()
{
$this->createAdminNotification(
'An invitation to leave a review on Trustpilot has failed due to a missing installation key.',
'Please enter your installation key in the Trustpilot extension configuration page to complete the integration. You can find your installation key in the Trustpilot Business > Integrations > Apps > Magento integration guide.',
'https://support.trustpilot.com/hc/en-us/articles/203934298-How-to-Guide-Trustpilot-s-Magento-Application'
);
}
}