$pincode = session('courier_location.pincode');
if (!$pincode) {
return back()->with('error', 'No pincode found in session.');
}
$warehouses = DB::connection('mysql2')
->table('richindi_couriers.api_warehouse')
->whereRaw("JSON_EXTRACT(data, '$.data.pincode') = CAST(? AS JSON)", [$pincode])
->select('id', 'warehouse_name', 'data', 'created_at')
->orderBy('id', 'asc')
->get();