From 7dccb503c04ab242ae5184ead5b5f80583f9dfd3 Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 3 Jul 2026 12:15:32 +0800 Subject: [PATCH] fix(seeder): hardcode detailed QC boundary to persist across database refreshes --- database/seeders/QuezonCitySeeder.php | 29 ++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/database/seeders/QuezonCitySeeder.php b/database/seeders/QuezonCitySeeder.php index 8cfaef5..bb809f3 100644 --- a/database/seeders/QuezonCitySeeder.php +++ b/database/seeders/QuezonCitySeeder.php @@ -35,15 +35,30 @@ class QuezonCitySeeder extends Seeder return; } - // 2. Find the user-created Quezon City LGU (Tenant) + // 2. Find or create the user-created Quezon City LGU (Tenant) with their specific high-detail boundary $tenant = Tenant::where('name', 'Quezon City')->first(); - if (!$tenant) { - $this->command->error("Tenant 'Quezon City' not found. Please create it first in LGU Management."); - return; - } + + $qcGeofenceGeoJson = '{"type":"Polygon","coordinates":[[[120.999985,14.66522],[121.005306,14.670701],[121.010885,14.676432],[121.019039,14.685149],[121.022472,14.688594],[121.021679,14.690275],[121.023545,14.691043],[121.024339,14.693286],[121.0267,14.693389],[121.026614,14.694407],[121.026936,14.691957],[121.028137,14.690039],[121.033888,14.697851],[121.038952,14.706232],[121.040583,14.716699],[121.03921,14.72168],[121.041183,14.722173],[121.041527,14.727323],[121.043931,14.730074],[121.06144,14.734204],[121.071567,14.737365],[121.078262,14.745168],[121.08324,14.748321],[121.087017,14.75779],[121.100579,14.765587],[121.104012,14.762261],[121.10899,14.763426],[121.112766,14.766582],[121.114827,14.771399],[121.120148,14.774718],[121.122895,14.772723],[121.124954,14.775216],[121.129246,14.776212],[121.131306,14.773886],[121.133194,14.776212],[121.135249,14.77364],[121.123238,14.764948],[121.122722,14.758472],[121.121006,14.752162],[121.118088,14.745851],[121.118774,14.739706],[121.114311,14.738878],[121.116028,14.734725],[121.118946,14.731902],[121.113968,14.698836],[121.111393,14.694199],[121.112251,14.685233],[121.106414,14.674614],[121.100235,14.670121],[121.097488,14.66465],[121.086846,14.656344],[121.087532,14.646042],[121.082382,14.642056],[121.077576,14.633375],[121.046677,14.620132],[121.033287,14.61299],[121.023159,14.609585],[121.018438,14.605679],[121.016636,14.602853],[121.009169,14.602026],[121.005306,14.603927],[120.988912,14.620626],[120.98917,14.625276],[120.993719,14.637155],[120.991831,14.639645],[120.992514,14.642441],[120.996037,14.650358],[121.000285,14.65752],[120.999985,14.66522]]]}'; + $polygon = Polygon::fromJson($qcGeofenceGeoJson); - // Ensure it's linked to the city - $tenant->update(['city_municipality_id' => $city->id]); + if (!$tenant) { + $this->command->info("Tenant 'Quezon City' not found. Creating it automatically with the high detail geofence..."); + $tenant = Tenant::create([ + 'uuid' => (string) Str::uuid(), + 'name' => 'Quezon City', + 'code' => 'QC', + 'short_name' => 'QC', + 'status' => Tenant::STATUS_ACTIVE, + 'qr_retail_price_centavos' => 1000, + 'boundary_polygon' => $polygon, + ]); + } + + // Ensure it's linked to the city and always has the detailed boundary + $tenant->update([ + 'city_municipality_id' => $city->id, + 'boundary_polygon' => $polygon, + ]); // 3. Define all 142 Barangays $barangayNames = [