mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-25 16:24:35 +02:00
* feat: initial commit for feature management * style: fix StyleCI findings * fix(api): prohibit features of nonnull scope from API & fix(admin): wrong translate key * style: fix Static Analysis error
49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Events\Admin\Feature;
|
|
|
|
use App\Concerns\Discord\HasAttributeUpdateEmbedFields;
|
|
use App\Enums\Discord\EmbedColor;
|
|
use App\Models\Admin\Feature;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use NotificationChannels\Discord\DiscordMessage;
|
|
|
|
/**
|
|
* Class FeatureUpdated.
|
|
*/
|
|
class FeatureUpdated extends FeatureEvent
|
|
{
|
|
use Dispatchable;
|
|
use HasAttributeUpdateEmbedFields;
|
|
|
|
/**
|
|
* Create a new event instance.
|
|
*
|
|
* @param Feature $feature
|
|
* @return void
|
|
*/
|
|
public function __construct(Feature $feature)
|
|
{
|
|
parent::__construct($feature);
|
|
$this->initializeEmbedFields($feature);
|
|
}
|
|
|
|
/**
|
|
* Get Discord message payload.
|
|
*
|
|
* @return DiscordMessage
|
|
*/
|
|
public function getDiscordMessage(): DiscordMessage
|
|
{
|
|
$feature = $this->getFeature();
|
|
|
|
return DiscordMessage::create('', [
|
|
'description' => "Feature '**{$feature->getName()}**' has been updated.",
|
|
'fields' => $this->getEmbedFields(),
|
|
'color' => EmbedColor::YELLOW,
|
|
]);
|
|
}
|
|
}
|