Explorar o código

luogo nascita e resindenza motorizzazione(untested)

FabioFratini hai 11 meses
pai
achega
0a4805a131
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  1. 13 0
      app/Http/Livewire/Report.php

+ 13 - 0
app/Http/Livewire/Report.php

@@ -24,6 +24,7 @@ use App\Models\Vehicle;
 use \Illuminate\Support\Facades\DB;
 use \Illuminate\Support\Facades\Log;
 use Webklex\PDFMerger\Facades\PDFMergerFacade as PDFMerger;
+use App\Models\LocationTown;
 
 class Report extends Component
 {
@@ -1375,7 +1376,19 @@ class Report extends Component
                     $this->anag_firstname = @$obj->dettaglioPatenteBaseOutput->anagrafica->nome;
                     $this->anag_lastname = @$obj->dettaglioPatenteBaseOutput->anagrafica->cognome;
                     $this->anag_birth_date = @$obj->dettaglioPatenteBaseOutput->anagrafica->dataNascita;
+
                     $this->anag_residenza_address = @$obj->dettaglioPatenteBaseOutput->datiResidenza->indirizzoResidenza;
+                    $residenzaTown = LocationTown::where('title', $obj->dettaglioPatenteBaseOutput->datiResidenza->comuneResidenza)
+                        ->first();
+
+                    $birthTown = null;
+                    if (isset($obj->dettaglioPatenteBaseOutput->luogoNascita->luogoItaliano)) {
+                        $birthTown = LocationTown::where('title', $obj->dettaglioPatenteBaseOutput->luogoNascita->luogoItaliano->descrizioneComunale)
+                            ->first();
+                    }
+
+                    $this->anag_residenza_town_id = $residenzaTown ? $residenzaTown->id : null;
+                    $this->anag_birth_town_id = $birthTown ? $birthTown->id : null;
                     $this->anag_documento_scadenza_il = @$obj->dettaglioPatenteBaseOutput->datiPatente->dataScadenza;
                     $this->anag_documento_rilasciato_il = @$obj->dettaglioPatenteBaseOutput->datiPatente->dataEmissione;
                 } catch (\SoapFault $fault) {