pp-planer/database/factories/ServiceFactory.php
Thorsten Bus 4c119b647d feat: add has_agenda flag to services and guard agenda sync
Events without an agenda in ChurchTools now gracefully set has_agenda=false
instead of throwing errors during sync. The edit/finalize buttons are
disabled in the frontend for services without an agenda.

Also fixes missing cts_song_id column on service_songs table.
2026-03-29 15:22:32 +02:00

32 lines
973 B
PHP

<?php
namespace Database\Factories;
use App\Models\Service;
use Illuminate\Database\Eloquent\Factories\Factory;
class ServiceFactory extends Factory
{
protected $model = Service::class;
public function definition(): array
{
$date = $this->faker->dateTimeBetween('now', '+6 months');
return [
'cts_event_id' => (string) $this->faker->unique()->numberBetween(10000, 99999),
'title' => $this->faker->sentence(4),
'date' => $date,
'preacher_name' => $this->faker->name(),
'beamer_tech_name' => $this->faker->name(),
'finalized_at' => $this->faker->optional()->dateTimeBetween('-2 weeks', 'now'),
'last_synced_at' => $this->faker->dateTimeBetween('-2 days', 'now'),
'cts_data' => [
'id' => $this->faker->uuid(),
'name' => $this->faker->sentence(3),
],
'has_agenda' => true,
];
}
}