-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
162 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace Database\Seeders; | ||
|
||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; | ||
use Illuminate\Database\Seeder; | ||
|
||
class CantonSeeder extends Seeder | ||
{ | ||
/** | ||
* Run the database seeds. | ||
*/ | ||
public function run(): void | ||
{ | ||
$cantons = | ||
[ | ||
['name' => 'Jura', 'img' => 'jura.png'], | ||
['name' => 'Zurich', 'img' => 'zurich.png'], | ||
['name' => 'Bern', 'img' => 'bern.png'], | ||
['name' => 'Lucerne', 'img' => 'lucerne.png'], | ||
['name' => 'Uri', 'img' => 'uri.png'], | ||
['name' => 'Schwyz', 'img' => 'schwyz.png'], | ||
['name' => 'Obwalden', 'img' => 'obwalden.png'], | ||
['name' => 'Nidwalden', 'img' => 'nidwalden.png'], | ||
['name' => 'Glarus', 'img' => 'glarus.png'], | ||
['name' => 'Zug', 'img' => 'zug.png'], | ||
['name' => 'Fribourg', 'img' => 'fribourg.png'], | ||
['name' => 'Solothurn', 'img' => 'solothurn.png'], | ||
['name' => 'Basel-Landschaft', 'img' => 'basel-landschaft.png'], | ||
['name' => 'Basel-Stadt', 'img' => 'basel-stadt.png'], | ||
['name' => 'Schaffhausen', 'img' => 'schaffhausen.png'], | ||
['name' => 'Appenzell Ausserrhoden', 'img' => 'appenzell-ausserrhoden.png'], | ||
['name' => 'Appenzell Innerrhoden', 'img' => 'appenzell-innerrhoden.png'], | ||
['name' => 'St. Gallen', 'img' => 'st-gallen.png'], | ||
['name' => 'Grisons', 'img' => 'grisons.png'], | ||
['name' => 'Aargau', 'img' => 'aargau.png'], | ||
['name' => 'Thurgau', 'img' => 'thurgau.png'], | ||
['name' => 'Ticino', 'img' => 'ticino.png'], | ||
['name' => 'Vaud', 'img' => 'vaud.png'], | ||
['name' => 'Valais', 'img' => 'valais.png'], | ||
['name' => 'Neuchâtel', 'img' => 'neuchatel.png'], | ||
['name' => 'Geneva', 'img' => 'geneva.png'] | ||
]; | ||
|
||
foreach ($cantons as $canton) | ||
{ | ||
\App\Models\Canton::create(array( | ||
'name' => $canton["name"], | ||
'img' => $canton["img"] | ||
)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,10 @@ public function run(): void | |
// 'name' => 'Test User', | ||
// 'email' => '[email protected]', | ||
// ]); | ||
|
||
$this->call(LangueSeeder::class); | ||
$this->call(CantonSeeder::class); | ||
$this->call(VilleSeeder::class); | ||
$this->call(LangueVilleSeeder::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Database\Seeders; | ||
|
||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; | ||
use Illuminate\Database\Seeder; | ||
|
||
class LangueSeeder extends Seeder | ||
{ | ||
/** | ||
* Run the database seeds. | ||
*/ | ||
public function run(): void | ||
{ | ||
$langues = | ||
[ | ||
['name' => 'Français'], | ||
['name' => 'Suisse-Allemand'], | ||
['name' => 'Italien'], | ||
['name' => 'Romanche'] | ||
]; | ||
|
||
foreach ($langues as $langue) | ||
{ | ||
\App\Models\Langue::create(array( | ||
'name' => $langue["name"] | ||
)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Database\Seeders; | ||
|
||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; | ||
use Illuminate\Database\Seeder; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
class LangueVilleSeeder extends Seeder | ||
{ | ||
/** | ||
* Run the database seeds. | ||
*/ | ||
public function run(): void | ||
{ | ||
$langues_villes = [ | ||
['ville_id' => 1, 'langue_id' => 1], | ||
['ville_id' => 2, 'langue_id' => 2], | ||
['ville_id' => 3, 'langue_id' => 1], | ||
['ville_id' => 3, 'langue_id' => 2], | ||
['ville_id' => 4, 'langue_id' => 2] | ||
|
||
]; | ||
|
||
foreach ($langues_villes as $langue_ville) | ||
{ | ||
DB::table('langues_villes')->insert([ | ||
'ville_id' => $langue_ville['ville_id'], | ||
'langue_id' => $langue_ville['langue_id'] | ||
]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Database\Seeders; | ||
|
||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; | ||
use Illuminate\Database\Seeder; | ||
|
||
class VilleSeeder extends Seeder | ||
{ | ||
/** | ||
* Run the database seeds. | ||
*/ | ||
public function run(): void | ||
{ | ||
$cities = [ | ||
['name' => 'Lausanne', 'img' => 'lausanne.png', 'ecusson' => 'lausanne-ecu.png', 'population' => 140000, 'coord' => '46.519961, 6.633597', 'canton_id' => 23], | ||
['name' => 'Zurich', 'img' => 'zurich.png', 'ecusson' => 'zurich-ecu.png', 'population' => 400000, 'coord' => '47.376886, 8.541694', 'canton_id' => 2], | ||
['name' => 'Bern', 'img' => 'bern.png', 'ecusson' => 'bern-ecu.png', 'population' => 130000, 'coord' => '46.948020, 7.447433', 'canton_id' => 3], | ||
['name' => 'Lucerne', 'img' => 'lucerne.png', 'ecusson' => 'lucerne-ecu.png', 'population' => 82000, 'coord' => '47.050168, 8.309307', 'canton_id' => 4] | ||
]; | ||
|
||
foreach ($cities as $city) | ||
{ | ||
\App\Models\Ville::create(array( | ||
'name' => $city["name"], | ||
'img' => $city["img"], | ||
'ecusson' => $city["ecusson"], | ||
'population' => $city["population"], | ||
'coord' => $city["coord"], | ||
'canton_id' => $city["canton_id"] | ||
)); | ||
} | ||
|
||
} | ||
} |