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,64 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\City;
|
||||
use App\Models\Country;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<City>
|
||||
*/
|
||||
class CityFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'country_id' => Country::factory(),
|
||||
'name' => fake()->city(),
|
||||
'latitude' => fake()->latitude(47, 55),
|
||||
'longitude' => fake()->longitude(6, 16),
|
||||
'osm_relation' => null,
|
||||
'simplified_geojson' => null,
|
||||
];
|
||||
}
|
||||
|
||||
public function vienna(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'name' => 'Wien',
|
||||
'latitude' => 48.2082,
|
||||
'longitude' => 16.3738,
|
||||
]);
|
||||
}
|
||||
|
||||
public function berlin(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'name' => 'Berlin',
|
||||
'latitude' => 52.5200,
|
||||
'longitude' => 13.4050,
|
||||
]);
|
||||
}
|
||||
|
||||
public function munich(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'name' => 'München',
|
||||
'latitude' => 48.1351,
|
||||
'longitude' => 11.5820,
|
||||
]);
|
||||
}
|
||||
|
||||
public function zurich(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'name' => 'Zürich',
|
||||
'latitude' => 47.3769,
|
||||
'longitude' => 8.5417,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user