public function run() { $fh = fopen(dirname(__FILE__) . '/zip_code_database_commercial.csv', 'r'); $count = 0; while (($line = fgetcsv($fh)) !== false) { if ($line[0] == 0 || $line[5] == 'PR' || $line[5] == 'VI') { // Puerto Rico or Virgin Islands continue; } $zip = new ZipCode(['zip' => $line[0], 'city' => $line[2], 'state' => $line[5], 'county' => $line[6], 'latitude' => $line[11], 'longitude' => $line[12]]); $zip->save(); $count++; if ($count % 1000 == 0) { echo "Added " . $count . " zip codes (Most recent: " . $line[0] . ")\n"; } } }
//Route::resource('api/gauges', 'Inventory\GaugeController'); Route::resource('api/colors', 'Inventory\\ColorController'); Route::resource('api/profiles', 'Inventory\\MetalProfileController'); Route::post('api/colors/attach', 'Inventory\\ColorController@attach'); Route::post('api/colors/detach', 'Inventory\\ColorController@detach'); Route::post('api/profiles/attach', 'Inventory\\MetalProfileController@attach'); Route::post('api/profiles/detach', 'Inventory\\MetalProfileController@detach'); Route::resource('api/specials', 'SiteComponents\\SpecialController'); Route::resource('api/news', 'SiteComponents\\NewsArticleController'); Route::resource('api/menus', 'SiteComponents\\MenuController'); Route::resource('api/pages', 'SiteComponents\\PageController'); Route::resource('api/contactforms', 'Forms\\ContactFormController'); Route::resource('api/jobs', 'People\\JobPostingController'); Route::resource('api/testimonials', 'SiteComponents\\TestimonialController'); Route::get('api/zip/{code}', function ($code) { $zip = ZipCode::where('zip', '=', $code)->first(); if ($zip == null) { abort(404); } else { return $zip; } }); // We'll let the admin panel define its own routes instead of // setting them all up here manually Route::match(['get', 'post'], 'admin/{one?}/{two?}/{three?}/{four?}/{five?}', 'AdminController@router'); Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']); Route::get('images/{one?}/{two?}/{three?}/{four?}/{five?}', 'SiteComponents\\ImageController@loadImage'); // A few oddities Route::get('/news/{article}', function ($article) { $viewing = NewsArticle::where('slug', $article)->first(); return View::make('dynamic_pages.article')->with(['title' => $viewing->short_title, 'article' => $viewing]);