public function getNodeName()
 {
     $this->result = '';
     foreach ($this->closed as $key) {
         $kota = \App\Models\kota::find($key);
         $this->result = $this->result . $kota->namaKota . ' - ';
     }
     return $this->result;
 }
 public function hitungBiaya()
 {
     //menghitung fValue dari kota yang dibuka
     //
     if (null === $this->currentGCost) {
         $this->currentGCost = 0;
     }
     //counting fValue
     foreach ($this->nextNodeID as $next) {
         echo 'calc f of ' . $next . PHP_EOL;
         $dest = \App\Models\kota::find($next);
         $gcost = \App\Models\real::where('idKotaTujuan', $next)->where('idKotaAsal', $this->currentEval)->pluck('gCost');
         $hcost = $dest->hCost->hCost;
         $this->fValue[$next] = $this->currentGCost + $gcost + $hcost;
     }
 }
 public function createModel($id)
 {
     try {
         $this->model = kota::find($id);
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }