feat: add scene settings feature

This commit is contained in:
2026-06-02 23:31:40 +03:30
parent b575b449cb
commit 82164f691f
6 changed files with 305 additions and 0 deletions
@@ -0,0 +1,33 @@
<?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::create('scenes', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('image_path')->nullable(); // scene background image
$table->string('video_path')->nullable(); // animated/video version of the scene
$table->string('sound_path')->nullable(); // scene ambient sound
$table->integer('order')->default(0);
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('scenes');
}
};
@@ -0,0 +1,34 @@
<?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::create('user_scene_settings', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->foreignId('active_scene_id')->nullable()->constrained('scenes')->nullOnDelete();
$table->unsignedInteger('scene_volume')->default(100); // صدای صحنه (0-100)
$table->unsignedInteger('background_play_seconds')->default(0); // پخش صدا خارج از برنامه
$table->boolean('video_enabled')->default(false); // تبدیل صحنه به ویدیو
$table->timestamps();
$table->unique('user_id'); // one settings row per user
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('user_scene_settings');
}
};