51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Display;
|
|
use App\Models\DisplayPlaylist;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @template TModel of \App\Models\DisplayPlaylist
|
|
*
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<TModel>
|
|
*/
|
|
class DisplayPlaylistFactory extends Factory
|
|
{
|
|
/**
|
|
* @var class-string<TModel>
|
|
*/
|
|
protected $model = DisplayPlaylist::class;
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'display_id' => Display::factory(),
|
|
'status' => DisplayPlaylist::STATUS_PUBLISHED,
|
|
'published_at' => now(),
|
|
'published_by' => null,
|
|
'notes' => null,
|
|
];
|
|
}
|
|
|
|
public function draft(): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'status' => DisplayPlaylist::STATUS_DRAFT,
|
|
'published_at' => null,
|
|
'published_by' => null,
|
|
]);
|
|
}
|
|
|
|
public function published(): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'status' => DisplayPlaylist::STATUS_PUBLISHED,
|
|
'published_at' => now(),
|
|
]);
|
|
}
|
|
}
|