Add homepage announcement module

This commit is contained in:
2026-05-01 11:43:08 +02:00
parent 961d21e91e
commit 874f8feb9c
16 changed files with 2968 additions and 2 deletions

View File

@@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('homepage_announcements', function (Blueprint $table): void {
$table->id();
$table->string('title', 180);
$table->string('subtitle', 255)->nullable();
$table->string('badge_text', 100)->nullable();
$table->longText('content_html')->nullable();
$table->string('type', 40)->default('announcement');
$table->string('status', 40)->default('draft');
$table->boolean('is_active')->default(true);
$table->dateTime('starts_at')->nullable();
$table->dateTime('ends_at')->nullable();
$table->string('primary_link_label', 80)->nullable();
$table->string('primary_link_type', 40)->nullable();
$table->string('primary_link_url', 2048)->nullable();
$table->string('primary_link_target_type', 40)->nullable();
$table->unsignedBigInteger('primary_link_target_id')->nullable();
$table->string('secondary_link_label', 80)->nullable();
$table->string('secondary_link_type', 40)->nullable();
$table->string('secondary_link_url', 2048)->nullable();
$table->string('secondary_link_target_type', 40)->nullable();
$table->unsignedBigInteger('secondary_link_target_id')->nullable();
$table->string('background_type', 40)->nullable();
$table->string('background_image', 2048)->nullable();
$table->string('gradient_preset', 80)->nullable();
$table->string('theme_preset', 80)->nullable();
$table->string('text_color', 32)->nullable();
$table->unsignedTinyInteger('overlay_opacity')->nullable();
$table->string('placement', 80)->default('homepage_after_featured');
$table->integer('priority')->default(0);
$table->boolean('is_dismissible')->default(true);
$table->unsignedInteger('dismiss_version')->default(1);
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamps();
$table->softDeletes();
$table->index('status');
$table->index('is_active');
$table->index('starts_at');
$table->index('ends_at');
$table->index('placement');
$table->index('priority');
$table->index(['placement', 'status', 'is_active', 'priority'], 'homepage_announcements_surface_idx');
});
}
public function down(): void
{
Schema::dropIfExists('homepage_announcements');
}
};