]> git.localhorst.tv Git - alttp.git/commitdiff
event banner
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 9 Jul 2025 13:42:30 +0000 (15:42 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 9 Jul 2025 13:42:30 +0000 (15:42 +0200)
app/DiscordBotCommands/EpisodeEventCommand.php
database/migrations/2025_07_09_113355_event_banner.php [new file with mode: 0644]

index 3dc03bbb796805ce7e11d0c273f68e7a995ed8f5..4c716b67d97ca5ded0d0d5acec36768edfa46671 100644 (file)
@@ -9,6 +9,7 @@ use Carbon\Carbon;
 use Discord\Discord;
 use Discord\Parts\Guild\Guild;
 use Discord\Parts\Guild\ScheduledEvent;
+use Illuminate\Support\Facades\Storage;
 use React\Promise\PromiseInterface;
 
 class EpisodeEventCommand extends BaseCommand {
@@ -66,7 +67,12 @@ class EpisodeEventCommand extends BaseCommand {
                $event->entity_metadata = [
                        'location' => $episode->getRestreamLink(),
                ];
-               $event->image = '';
+               if ($episode->event && $episode->event->banner) {
+                       $file = Storage::get($episode->event->banner);
+                       $event->image = 'data:image/png;base64,'.base64_encode($file);
+               } else {
+                       $event->image = '';
+               }
        }
 
 }
diff --git a/database/migrations/2025_07_09_113355_event_banner.php b/database/migrations/2025_07_09_113355_event_banner.php
new file mode 100644 (file)
index 0000000..59d8b51
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+       /**
+        * Run the migrations.
+        */
+       public function up(): void {
+               Schema::table('events', function(Blueprint $table) {
+                       $table->string('banner')->default('');
+               });
+       }
+
+       /**
+        * Reverse the migrations.
+        */
+       public function down(): void {
+               Schema::table('events', function(Blueprint $table) {
+                       $table->dropColumn('banner');
+               });
+       }
+};