Fixes to finding a record when FTN when region_id/host_id have the same value

This commit is contained in:
Deon George
2021-11-20 11:50:45 +11:00
parent 483e35202b
commit 6f9df005aa
3 changed files with 12 additions and 12 deletions

View File

@@ -19,7 +19,7 @@ use App\Traits\{ScopeActive,UsePostgres};
* + id | zone_id | region_id | host_id | node_id | point_id | status | role | system_id | hub_id
* + ----+---------+-----------+---------+---------+----------+--------+------+-----------+--------
* + 533 | 6 | 3 | 0 | 1 | 0 | | 4 | 1 |
* + 534 | 6 | 3 | 3 | 1 | 0 | | 2 | 1 |
* + 534 | 6 | n | 3 | 1 | 0 | | 2 | 1 |
* + 535 | 6 | 0 | 3 | 1 | 0 | | 2 | 1 |
*/
class Address extends Model
@@ -311,13 +311,12 @@ class Address extends Model
->where(function($q) use ($ftn) {
return $q->where(function($qq) use ($ftn) {
return $qq
->where('region_id',0)
->where('host_id',$ftn['n']);
->where('region_id',$ftn['n'])
->where('host_id',0);
})
->orWhere(function($qq) use ($ftn) {
return $qq
->where('region_id',$ftn['n'])
->where('host_id',0);
return $qq
->where('host_id',$ftn['n']);
});
})
->where('node_id',$ftn['f'])