mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
6015dcbbbf
* refactor: migration from laravel-enum package to native php enums * style: fix StyleCI findings
49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Events\Admin\Setting;
|
|
|
|
use App\Concerns\Discord\HasAttributeUpdateEmbedFields;
|
|
use App\Enums\Discord\EmbedColor;
|
|
use App\Models\Admin\Setting;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use NotificationChannels\Discord\DiscordMessage;
|
|
|
|
/**
|
|
* Class SettingUpdated.
|
|
*/
|
|
class SettingUpdated extends SettingEvent
|
|
{
|
|
use Dispatchable;
|
|
use HasAttributeUpdateEmbedFields;
|
|
|
|
/**
|
|
* Create a new event instance.
|
|
*
|
|
* @param Setting $setting
|
|
* @return void
|
|
*/
|
|
public function __construct(Setting $setting)
|
|
{
|
|
parent::__construct($setting);
|
|
$this->initializeEmbedFields($setting);
|
|
}
|
|
|
|
/**
|
|
* Get Discord message payload.
|
|
*
|
|
* @return DiscordMessage
|
|
*/
|
|
public function getDiscordMessage(): DiscordMessage
|
|
{
|
|
$setting = $this->getSetting();
|
|
|
|
return DiscordMessage::create('', [
|
|
'description' => "Setting '**{$setting->getName()}**' has been updated.",
|
|
'fields' => $this->getEmbedFields(),
|
|
'color' => EmbedColor::YELLOW->value,
|
|
]);
|
|
}
|
|
}
|