35 lines
995 B
PHP
35 lines
995 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\MaintenanceWindow;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/** @extends Factory<MaintenanceWindow> */
|
|
class MaintenanceWindowFactory extends Factory
|
|
{
|
|
protected $model = MaintenanceWindow::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'title' => 'Netzwerk-Wartung '.$this->faker->city(),
|
|
'public_description' => 'Kurzzeitige Nichtverfügbarkeit möglich.',
|
|
'internal_notes' => null,
|
|
'starts_at' => now()->addDays(2),
|
|
'ends_at' => now()->addDays(2)->addHours(2),
|
|
'state' => 'draft',
|
|
];
|
|
}
|
|
|
|
public function scheduled(): static
|
|
{
|
|
return $this->state(['state' => 'scheduled', 'published_at' => now()]);
|
|
}
|
|
|
|
public function active(): static
|
|
{
|
|
return $this->state(['state' => 'scheduled', 'published_at' => now(), 'starts_at' => now()->subHour(), 'ends_at' => now()->addHour()]);
|
|
}
|
|
}
|