mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-05-20 10:04:53 +00:00
cb61d9d543
🎨 Refactor `Lecturer` model to include new fields and factory usage 🔧 Update `DatabaseSeeder` to handle default seeds 🛠️ Enhance `einundzwanzig` database configuration for SQLite compatibility
43 lines
937 B
PHP
43 lines
937 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Course;
|
|
use App\Models\CourseEvent;
|
|
use App\Models\Venue;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<CourseEvent>
|
|
*/
|
|
class CourseEventFactory extends Factory
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$from = fake()->dateTimeBetween('+1 day', '+90 days');
|
|
$to = (clone $from)->modify('+2 hours');
|
|
|
|
return [
|
|
'course_id' => Course::factory(),
|
|
'venue_id' => Venue::factory(),
|
|
'from' => $from,
|
|
'to' => $to,
|
|
];
|
|
}
|
|
|
|
public function past(): static
|
|
{
|
|
return $this->state(function () {
|
|
$from = fake()->dateTimeBetween('-90 days', '-1 day');
|
|
|
|
return [
|
|
'from' => $from,
|
|
'to' => (clone $from)->modify('+2 hours'),
|
|
];
|
|
});
|
|
}
|
|
}
|