Files
animethemes-server/app/Events/Admin/Setting/SettingCreated.php
T
paranarimasu 5517d4061e feat(admin): add settings to override config values (#448)
* feat(admin): add settings to override config values

* style: fix StyleCI findings

* refactor: use model constants in migration
2022-08-26 12:53:55 -05:00

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);
}
}