|
@@ -0,0 +1,84 @@
|
|
|
+
|
|
|
+$table->string('copyright_detail_code')->nullable();
|
|
|
+$table->string('zip_code')->nullable();
|
|
|
+$table->string('update_key_no')->nullable();
|
|
|
+$table->string('action_code')->nullable();
|
|
|
+$table->string('record_type_code')->nullable();
|
|
|
+$table->string('carrier_route_id')->nullable();
|
|
|
+$table->string('street_pre_drctn_abbrev')->nullable();
|
|
|
+$table->string('street_name')->nullable();
|
|
|
+$table->string('street_suffix_abbrev')->nullable();
|
|
|
+$table->string('street_post_drctn_abbrev')->nullable();
|
|
|
+$table->string('addr_primary_low_no')->nullable();
|
|
|
+$table->string('addr_primary_high_no')->nullable();
|
|
|
+$table->string('addr_prmry_odd_even_code')->nullable();
|
|
|
+$table->string('building_or_firm_name')->nullable();
|
|
|
+$table->string('addr_secondary_abbrev')->nullable();
|
|
|
+$table->string('addr_secondary_low_no')->nullable();
|
|
|
+$table->string('addr_secondary_high_no')->nullable();
|
|
|
+$table->string('addr_secny_odd_even_code')->nullable();
|
|
|
+$table->string('low_no_zip_sector_no')->nullable();
|
|
|
+$table->string('low_no_zip_segment_no')->nullable();
|
|
|
+$table->string('high_no_zip_sector_no')->nullable();
|
|
|
+$table->string('high_no_zip_segment_no')->nullable();
|
|
|
+$table->string('base_alt_code')->nullable();
|
|
|
+$table->string('lacs_status_ind')->nullable();
|
|
|
+$table->string('govt_bldg_ind')->nullable();
|
|
|
+$table->string('finance_no')->nullable();
|
|
|
+$table->string('stusps')->nullable();
|
|
|
+$table->string('countyfp')->nullable();
|
|
|
+$table->string('congressional_dist_no')->nullable();
|
|
|
+$table->string('muncipality_ctyst_key')->nullable();
|
|
|
+$table->string('urbanization_ctyst_key')->nullable();
|
|
|
+$table->string('prefd_last_line_ctyst_key)->nullable();
|
|
|
+
|
|
|
+
|
|
|
+$positions = [
|
|
|
+ [1,1,'copyright_detail_code'],
|
|
|
+ [2,5,'zip_code'],
|
|
|
+ [7,10,'update_key_no'],
|
|
|
+ [17,1,'action_code'],
|
|
|
+ [18,1,'record_type_code'],
|
|
|
+ [19,4,'carrier_route_id'],
|
|
|
+ [23,2,'street_pre_drctn_abbrev'],
|
|
|
+ [25,28,'street_name'],
|
|
|
+ [53,4,'street_suffix_abbrev'],
|
|
|
+ [57,2,'street_post_drctn_abbrev'],
|
|
|
+ [59,10,'addr_primary_low_no'],
|
|
|
+ [69,10,'addr_primary_high_no'],
|
|
|
+ [79,1,'addr_prmry_odd_even_code'],
|
|
|
+ [80,40,'building_or_firm_name'],
|
|
|
+ [120,4,'addr_secondary_abbrev'],
|
|
|
+ [124,8,'addr_secondary_low_no'],
|
|
|
+ [132,8,'addr_secondary_high_no'],
|
|
|
+ [140,1,'addr_secny_odd_even_code'],
|
|
|
+ [141,2,'low_no_zip_sector_no'],
|
|
|
+ [143,2,'low_no_zip_segment_no'],
|
|
|
+ [145,2,'high_no_zip_sector_no'],
|
|
|
+ [147,2,'high_no_zip_segment_no'],
|
|
|
+ [149,1,'base_alt_code'],
|
|
|
+ [150,1,'lacs_status_ind'],
|
|
|
+ [151,1,'govt_bldg_ind'],
|
|
|
+ [152,6,'finance_no'],
|
|
|
+ [158,2,'stusps'],
|
|
|
+ [160,3,'countyfp'],
|
|
|
+ [163,2,'congressional_dist_no'],
|
|
|
+ [165,6,'muncipality_ctyst_key'],
|
|
|
+ [171,6,'urbanization_ctyst_key'],
|
|
|
+ [177,6,'prefd_last_line_ctyst_key]'
|
|
|
+];
|
|
|
+
|
|
|
+$filePath = '/home/josh/output.txt';
|
|
|
+
|
|
|
+$handle = fopen($filePath, "r") or die("Couldn't get handle");
|
|
|
+if ($handle) {
|
|
|
+ while (!feof($handle)) {
|
|
|
+ $buffer = fgets($handle, 4096);
|
|
|
+ $row = new Zip4Row();
|
|
|
+ foreach($positions as $position){
|
|
|
+ $row->{$position[2]} = substr($l, $position[0], $position[1]);
|
|
|
+ }
|
|
|
+ $row->save();
|
|
|
+ }
|
|
|
+ fclose($handle);
|
|
|
+}
|