feat(#29): mashup

* update templates to be more responsive
This commit is contained in:
Benjamin Nussbaum 2025-06-06 23:06:31 +02:00
parent ed9d03d0b8
commit 56638b26e8
28 changed files with 1067 additions and 346 deletions

View file

@ -17,6 +17,7 @@ class PlaylistItemFactory extends Factory
return [
'playlist_id' => Playlist::factory(),
'plugin_id' => Plugin::factory(),
'mashup' => null,
'order' => $this->faker->numberBetween(0, 100),
'is_active' => $this->faker->boolean(80), // 80% chance of being active
'last_displayed_at' => null,

View file

@ -0,0 +1,22 @@
<?php
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::table('playlist_items', function (Blueprint $table) {
$table->json('mashup')->nullable();
});
}
public function down(): void
{
Schema::table('playlist_items', function (Blueprint $table) {
$table->dropColumn('mashup');
});
}
};

View file

@ -34,6 +34,7 @@ class DatabaseSeeder extends Seeder
$this->call([
ExampleRecipesSeeder::class,
MashupPocSeeder::class,
]);
}
}

View file

@ -0,0 +1,50 @@
<?php
namespace Database\Seeders;
use App\Models\Playlist;
use App\Models\PlaylistItem;
use Illuminate\Database\Seeder;
class MashupPocSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// Create a playlist
$playlist = Playlist::create([
'device_id' => 1,
'name' => 'Mashup Test Playlist',
'is_active' => true,
]);
// Create a playlist item with 1Tx1B layout using the new JSON structure
PlaylistItem::createMashup(
playlist: $playlist,
layout: '1Tx1B',
pluginIds: [2, 3], // Top and bottom plugins
name: 'Mashup 1Tx1B',
order: 1
);
// Create another playlist item with 2x2 layout
PlaylistItem::createMashup(
playlist: $playlist,
layout: '1Lx1R',
pluginIds: [2, 6], // All four quadrants
name: 'Mashup Quadrant',
order: 2
);
// Create a single plugin item (no mashup)
PlaylistItem::create([
'playlist_id' => $playlist->id,
'plugin_id' => 1,
'mashup' => null,
'is_active' => true,
'order' => 3,
]);
}
}