Various changes including contact messages in database, contact message notifications, notification emails, bugfixes and more
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Notification\Admin;
|
||||
|
||||
use Notification;
|
||||
|
||||
require_once 'Notification.php';
|
||||
|
||||
class ContactMessageNotification extends \Notification
|
||||
{
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$data['type'] = 'admin.contactMessage';
|
||||
parent::__construct($data);
|
||||
}
|
||||
|
||||
public function getNotificationLink()
|
||||
{
|
||||
return '/admin/contact';
|
||||
}
|
||||
|
||||
public function getNotificationImage()
|
||||
{
|
||||
return $this->sender->getProfilePicture();
|
||||
}
|
||||
|
||||
public function messageForNotification(Notification $notification)
|
||||
{
|
||||
return ['line' => 'admin.contactMessage.single', 'attributes' => [$this->sender->getName(), $notification->parameters]];
|
||||
}
|
||||
|
||||
public function messageForNotifications(array $notifications, $realCount = 0)
|
||||
{
|
||||
if ($realCount === 0) {
|
||||
$realCount = count($notifications);
|
||||
}
|
||||
|
||||
if ($realCount < 5) {
|
||||
$names = $this->manyNames($notifications);
|
||||
return ['line' => 'admin.contactMessage.multiple', 'attributes' => [$names]];
|
||||
} else {
|
||||
$names = $this->manyNamesCutoff($notifications, $realCount);
|
||||
return ['line' => 'admin.contactMessage.many', 'attributes' => [$names]];
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user