Untitled

 avatar
unknown
plain_text
5 days ago
1.5 kB
2
Indexable
$ordersenderKecamatanId = $orderDelivery['senderDistrictId'];
        $ordersenderKelurahanId = $orderDelivery['senderSubDistrictId'];


        $orderdistrictId        = $orderDelivery['recipientDistrictId'];
        $ordersubDistrictId     = $orderDelivery['recipientSubDistrictId'];



        $ms_district = (new Query())
            ->select('kaDistrictId')
            ->from('ms_district');

        $ms_sub_district = (new Query())
            ->select('kaSubDistrictId')
            ->from('ms_sub_district');


        if ($ordersenderKecamatanId != null) {
            $ms_sender_district = $ms_district->where(['id' => $ordersenderKecamatanId])->one();
            $orderDelivery['senderDistrictId'] = $ordersenderKecamatanId;
        }

        if ($ordersenderKelurahanId != null) {
            $ms_sender_sub_district_id = $ms_sub_district->where(['id' => $ordersenderKelurahanId])->one();
            $orderDelivery['senderSubDistrictId'] = $ms_sender_sub_district_id['kaSubDistrictId'];
        }

        if ($orderdistrictId != null) {
            $ms_sender_district = $ms_district->where(['id' => $orderdistrictId])->one();
            $orderDelivery['recipientDistrictId'] = $ms_sender_district['kaDistrictId'];
        }

        if ($ordersubDistrictId != null) {
            $ms_sender_sub_district_id = $ms_sub_district->where(['id' => $ordersubDistrictId])->one();
            $orderDelivery['recipientSubDistrictId'] = $ms_sender_sub_district_id['kaSubDistrictId'];
        }
Leave a Comment