selectOne('SELECT current_database() AS database, inet_server_port() AS port');if($target!==['database'=>'stability_consumers_20261011_084534_test','port'=>55441])throw new RuntimeException('QA only');$db->beginTransaction();$db->statement('SET TRANSACTION READ ONLY');try{ $c=App\Models\LandAssistanceCase::findOrFail('01a13504-61d9-7033-89dd-40563f857517');$p=['SQL_read_only'=>true,'target'=>$target,'case_version'=>$c->version,'options'=>[],'active_changes'=>0];$parent=''; foreach(['province_id'=>'province','district_id'=>'district','admin_post_id'=>'admin_post','locality_id'=>'locality'] as $field=>$type){$id=$c->payload['parcels'][0][$field];$q=['type'=>$type,'id'=>$id];if($parent)$q['parent_id']=$parent; try{$req=Illuminate\Http\Request::create('/api/v1/investment/territory-options','GET',$q);$res=app(App\Http\Controllers\PublicGeographyController::class)->options($req,app(App\Services\InvestmentGeography::class));$data=$res->getData(true);$p['options'][]=['field'=>$field,'requested_id'=>$id,'status'=>$res->status(),'rows'=>$data['data']??null];}catch(Throwable $e){$p['options'][]=['field'=>$field,'error_class'=>get_class($e),'message'=>$e->getMessage()];}$parent=$id;} $path=__DIR__.'/line11-options-diagnosis-20261015.json';if(is_file($path))throw new RuntimeException('Preserve evidence');file_put_contents($path,json_encode($p,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE).PHP_EOL);echo json_encode($p,JSON_UNESCAPED_UNICODE); }finally{$db->rollBack();}