fix: Playlist, PlaylistItem Factories after migration change

This commit is contained in:
Benjamin Nussbaum 2025-03-14 17:35:49 +01:00
parent 11f4ccb946
commit ec862942cd
2 changed files with 10 additions and 12 deletions

View file

@ -4,7 +4,6 @@ namespace Database\Factories;
use App\Models\Device; use App\Models\Device;
use App\Models\Playlist; use App\Models\Playlist;
use App\Models\Plugin;
use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@ -15,14 +14,14 @@ class PlaylistFactory extends Factory
public function definition(): array public function definition(): array
{ {
return [ return [
'order' => $this->faker->randomNumber(), 'name' => $this->faker->words(3, true),
'is_active' => $this->faker->boolean(), 'is_active' => $this->faker->boolean(80), // 80% chance of being active
'last_displayed_at' => Carbon::now(), 'weekdays' => $this->faker->randomElements(range(0, 6), $this->faker->numberBetween(1, 7)),
'active_from' => $this->faker->time('H:i:s'),
'active_until' => $this->faker->time('H:i:s'),
'created_at' => Carbon::now(), 'created_at' => Carbon::now(),
'updated_at' => Carbon::now(), 'updated_at' => Carbon::now(),
'device_id' => Device::factory(), 'device_id' => Device::factory(),
'plugin_id' => Plugin::factory(),
]; ];
} }
} }

View file

@ -15,14 +15,13 @@ class PlaylistItemFactory extends Factory
public function definition(): array public function definition(): array
{ {
return [ return [
'order' => $this->faker->randomNumber(),
'is_active' => $this->faker->boolean(),
'last_displayed_at' => Carbon::now(),
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
'playlist_id' => Playlist::factory(), 'playlist_id' => Playlist::factory(),
'plugin_id' => Plugin::factory(), 'plugin_id' => Plugin::factory(),
'order' => $this->faker->numberBetween(0, 100),
'is_active' => $this->faker->boolean(80), // 80% chance of being active
'last_displayed_at' => null,
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
]; ];
} }
} }