46 lines
1 KiB
PHP
46 lines
1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Display;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @template TModel of \App\Models\Display
|
|
*
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<TModel>
|
|
*/
|
|
class DisplayFactory extends Factory
|
|
{
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var class-string<TModel>
|
|
*/
|
|
protected $model = Display::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => fake()->words(2, true),
|
|
'location' => fake()->optional()->words(3, true),
|
|
'is_active' => true,
|
|
'is_test' => false,
|
|
'preview_token' => null,
|
|
];
|
|
}
|
|
|
|
public function test(): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'is_test' => true,
|
|
'name' => 'Test-Display',
|
|
'location' => 'Vorschau / Test',
|
|
]);
|
|
}
|
|
}
|