mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-09-07 21:23:11 +02:00
* feat(admin): add settings to override config values * style: fix StyleCI findings * refactor: use model constants in migration
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Events\Admin\Setting;
|
|
|
|
use App\Constants\Config\ServiceConstants;
|
|
use App\Contracts\Events\DiscordMessageEvent;
|
|
use App\Enums\Discord\EmbedColor;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Support\Facades\Config;
|
|
use NotificationChannels\Discord\DiscordMessage;
|
|
|
|
/**
|
|
* Class SettingCreated.
|
|
*/
|
|
class SettingCreated extends SettingEvent implements DiscordMessageEvent
|
|
{
|
|
use Dispatchable;
|
|
use SerializesModels;
|
|
|
|
/**
|
|
* Get Discord message payload.
|
|
*
|
|
* @return DiscordMessage
|
|
*/
|
|
public function getDiscordMessage(): DiscordMessage
|
|
{
|
|
$setting = $this->getSetting();
|
|
|
|
return DiscordMessage::create('', [
|
|
'description' => "Setting '**{$setting->getName()}**' has been created.",
|
|
'color' => EmbedColor::GREEN,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Get Discord channel the message will be sent to.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getDiscordChannel(): string
|
|
{
|
|
return Config::get(ServiceConstants::ADMIN_DISCORD_CHANNEL_QUALIFIED);
|
|
}
|
|
}
|