mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-05-20 10:04:53 +00:00
🔥 Add initial database migrations, seeders, and factories
🎨 Refactor `Lecturer` model to include new fields and factory usage 🔧 Update `DatabaseSeeder` to handle default seeds 🛠️ Enhance `einundzwanzig` database configuration for SQLite compatibility
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Election;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ElectionSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$candidates = config('einundzwanzig.config.current_board');
|
||||
|
||||
Election::query()->updateOrCreate(
|
||||
['year' => 2025],
|
||||
[
|
||||
'candidates' => $candidates,
|
||||
'end_time' => now()->setDate(2025, 4, 15),
|
||||
]
|
||||
);
|
||||
|
||||
Election::query()->updateOrCreate(
|
||||
['year' => 2026],
|
||||
[
|
||||
'candidates' => $candidates,
|
||||
'end_time' => now()->addMonths(2),
|
||||
]
|
||||
);
|
||||
|
||||
Election::query()->updateOrCreate(
|
||||
['year' => 2027],
|
||||
[
|
||||
'candidates' => [],
|
||||
'end_time' => now()->addYear()->addMonths(3),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user