2020-10-01 04:10:28 +05:30
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace common\notifications;
|
|
|
|
|
|
|
|
use common\models\Account;
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
final readonly class AccountEditNotification implements NotificationInterface {
|
2020-10-01 04:10:28 +05:30
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function __construct(
|
|
|
|
private Account $account,
|
|
|
|
private array $changedAttributes,
|
|
|
|
) {
|
2020-10-01 04:10:28 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
public static function getType(): string {
|
|
|
|
return 'account.edit';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPayloads(): array {
|
|
|
|
return [
|
|
|
|
'id' => $this->account->id,
|
|
|
|
'uuid' => $this->account->uuid,
|
|
|
|
'username' => $this->account->username,
|
|
|
|
'email' => $this->account->email,
|
|
|
|
'lang' => $this->account->lang,
|
|
|
|
'isActive' => $this->account->status === Account::STATUS_ACTIVE,
|
|
|
|
'isDeleted' => $this->account->status === Account::STATUS_DELETED,
|
|
|
|
'registered' => date('c', (int)$this->account->created_at),
|
|
|
|
'changedAttributes' => $this->changedAttributes,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|