From 6f9df005aac4accfb3c2c326bd423c9da69cf91d Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 20 Nov 2021 11:50:45 +1100 Subject: [PATCH] Fixes to finding a record when FTN when region_id/host_id have the same value --- .env.testing | 12 ++++++------ app/Models/Address.php | 11 +++++------ composer.json | 1 + 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.env.testing b/.env.testing index 266ef54..61d68aa 100644 --- a/.env.testing +++ b/.env.testing @@ -1,6 +1,6 @@ -APP_NAME="Clearing Houz" +APP_NAME="Clearing Houz Testing" APP_ENV=testing -APP_KEY= +APP_KEY=base64:FiMSvv4J7jDfy6W/sHrQ9YImuUYaxynYCcXQJwp/6Tc= APP_DEBUG=true #APP_URL=http://localhost @@ -8,11 +8,11 @@ LOG_CHANNEL=stderr LOG_LEVEL=info DB_CONNECTION=pgsql -DB_HOST=database +DB_HOST=postgres-test DB_PORT=5432 DB_DATABASE=postgres DB_USERNAME=postgres -DB_PASSWORD=secret +DB_PASSWORD=password DB_MONGO_HOST=mongo DB_MONGO_USERNAME=mongo @@ -29,8 +29,8 @@ REDIS_PASSWORD= REDIS_PORT=6379 MAIL_DRIVER=smtp -MAIL_HOST=mail.leenooks.vpn -MAIL_PORT=25 +MAIL_HOST=smtp.mailtrap.io +MAIL_PORT=2525 MAIL_USERNAME= MAIL_PASSWORD= MAIL_ENCRYPTION= diff --git a/app/Models/Address.php b/app/Models/Address.php index 00c46fe..4415322 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -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']) diff --git a/composer.json b/composer.json index 16b8f4c..2788005 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ "facade/ignition": "^2.5", "fakerphp/faker": "^1.9.1", "mockery/mockery": "^1.4.2", + "nunomaduro/collision": "^5.10", "phpunit/phpunit": "^9.3.3" }, "config": {