Created
May 7, 2016 14:23
-
-
Save volkanmetin/1c96d193a0047f98af31e809ad497fb1 to your computer and use it in GitHub Desktop.
Turkey Cities Seeder
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
<?php | |
use Illuminate\Database\Seeder; | |
use App\Models\City; | |
class CityTableSeeder extends Seeder | |
{ | |
/** | |
* Run the database seeds. | |
* | |
* @return void | |
*/ | |
public function run() | |
{ | |
City::whereNotNull('id')->delete(); | |
$cities = [ | |
['code' => 1, 'name' => 'Adana'], | |
['code' => 2, 'name' => 'Adıyaman'], | |
['code' => 3, 'name' => 'Afyonkarahisar'], | |
['code' => 4, 'name' => 'Ağrı'], | |
['code' => 5, 'name' => 'Amasya'], | |
['code' => 6, 'name' => 'Ankara'], | |
['code' => 7, 'name' => 'Antalya'], | |
['code' => 8, 'name' => 'Artvin'], | |
['code' => 9, 'name' => 'Aydın'], | |
['code' => 10, 'name' => 'Balıkesir'], | |
['code' => 11, 'name' => 'Bilecik'], | |
['code' => 12, 'name' => 'Bingöl'], | |
['code' => 13, 'name' => 'Bitlis'], | |
['code' => 14, 'name' => 'Bolu'], | |
['code' => 15, 'name' => 'Burdur'], | |
['code' => 16, 'name' => 'Bursa'], | |
['code' => 17, 'name' => 'Çanakkale'], | |
['code' => 18, 'name' => 'Çankırı'], | |
['code' => 19, 'name' => 'Çorum'], | |
['code' => 20, 'name' => 'Denizli'], | |
['code' => 21, 'name' => 'Diyarbakır'], | |
['code' => 22, 'name' => 'Edirne'], | |
['code' => 23, 'name' => 'Elazığ'], | |
['code' => 24, 'name' => 'Erzincan'], | |
['code' => 25, 'name' => 'Erzurum'], | |
['code' => 26, 'name' => 'Eskişehir'], | |
['code' => 27, 'name' => 'Gaziantep'], | |
['code' => 28, 'name' => 'Giresun'], | |
['code' => 29, 'name' => 'Gümüşhane'], | |
['code' => 30, 'name' => 'Hakkâri'], | |
['code' => 31, 'name' => 'Hatay'], | |
['code' => 32, 'name' => 'Isparta'], | |
['code' => 33, 'name' => 'Mersin'], | |
['code' => 34, 'name' => 'İstanbul'], | |
['code' => 35, 'name' => 'İzmir'], | |
['code' => 36, 'name' => 'Kars'], | |
['code' => 37, 'name' => 'Kastamonu'], | |
['code' => 38, 'name' => 'Kayseri'], | |
['code' => 39, 'name' => 'Kırklareli'], | |
['code' => 40, 'name' => 'Kırşehir'], | |
['code' => 41, 'name' => 'Kocaeli'], | |
['code' => 42, 'name' => 'Konya'], | |
['code' => 43, 'name' => 'Kütahya'], | |
['code' => 44, 'name' => 'Malatya'], | |
['code' => 45, 'name' => 'Manisa'], | |
['code' => 46, 'name' => 'Kahramanmaraş'], | |
['code' => 47, 'name' => 'Mardin'], | |
['code' => 48, 'name' => 'Muğla'], | |
['code' => 49, 'name' => 'Muş'], | |
['code' => 50, 'name' => 'Nevşehir'], | |
['code' => 51, 'name' => 'Niğde'], | |
['code' => 52, 'name' => 'Ordu'], | |
['code' => 53, 'name' => 'Rize'], | |
['code' => 54, 'name' => 'Sakarya'], | |
['code' => 55, 'name' => 'Samsun'], | |
['code' => 56, 'name' => 'Siirt'], | |
['code' => 57, 'name' => 'Sinop'], | |
['code' => 58, 'name' => 'Sivas'], | |
['code' => 59, 'name' => 'Tekirdağ'], | |
['code' => 60, 'name' => 'Tokat'], | |
['code' => 61, 'name' => 'Trabzon'], | |
['code' => 62, 'name' => 'Tunceli'], | |
['code' => 63, 'name' => 'Şanlıurfa'], | |
['code' => 64, 'name' => 'Uşak'], | |
['code' => 65, 'name' => 'Van'], | |
['code' => 66, 'name' => 'Yozgat'], | |
['code' => 67, 'name' => 'Zonguldak'], | |
['code' => 68, 'name' => 'Aksaray'], | |
['code' => 69, 'name' => 'Bayburt'], | |
['code' => 70, 'name' => 'Karaman'], | |
['code' => 71, 'name' => 'Kırıkkale'], | |
['code' => 72, 'name' => 'Batman'], | |
['code' => 73, 'name' => 'Şırnak'], | |
['code' => 74, 'name' => 'Bartın'], | |
['code' => 75, 'name' => 'Ardahan'], | |
['code' => 76, 'name' => 'Iğdır'], | |
['code' => 77, 'name' => 'Yalova'], | |
['code' => 78, 'name' => 'Karabük'], | |
['code' => 79, 'name' => 'Kilis'], | |
['code' => 80, 'name' => 'Osmaniye'], | |
['code' => 81, 'name' => 'Düzce'], | |
]; | |
foreach ($cities as $city) | |
City::create($city); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bunun ülke-il-ilçe versiyonunu da yapmak lazım. Şimdilik sadece il lazım. Boş bir zamanda modellerle beraber hepsini paketlemek lazım.