Ejemplo n.º 1
0
 private function handleCounties()
 {
     $url = $this->url_base . 'SearchOffender.aspx';
     $this->crawler = $this->client->request('GET', $url);
     $county = GaCounty::where('status', '=', '0')->orderByRaw("RAND()")->first();
     if ($county) {
         if (App::runningInConsole()) {
             fwrite(STDOUT, "=========== County : " . $county->name . PHP_EOL);
         }
         $this->curr_county_id = $county->county_id;
         $this->curr_county_pages = $county->pages;
         echo $county->county_id . " : " . $county->name . "\n";
         //
         $this->expected_records = $this->curr_county_pages * 10;
         $total_counties = GaCounty::count();
         $counties_crawled = GaCounty::where('status', '!=', '0')->count();
         $this->state->status = $counties_crawled + 1 . "/" . $total_counties . " - County: " . $county->name;
         $this->estimate_time('counties');
         $this->start_time = time();
         //
         $this->changeCounty($county->county_id);
     } else {
         if (App::runningInConsole()) {
             fwrite(STDOUT, "=========== County DONE" . PHP_EOL);
             fwrite(STDOUT, "=========== Incarcerated : Yes " . PHP_EOL);
         }
         $this->incarceratedYes();
         if (App::runningInConsole()) {
             fwrite(STDOUT, "=========== Incarcerated : Yes ** Done" . PHP_EOL);
         }
         $this->records_crawled = GaOffender::count();
         $this->completed();
     }
 }