app/Http/Controllers/Admin/LocationController.php
private function getPlaceListLocation(int $id): array
    {
        // We know the id of the place in the placelocation table,
        // now get the id of the same place in the places table
        if ($id === 0) {
            $fqpn = '';
        } else {
            $hierarchy = $this->getHierarchy($id);
            $fqpn      = ', ' . $hierarchy[0]->fqpn;
        }

        $rows = DB::table('placelocation')
            ->where('pl_parent_id', '=', $id)
            ->orderBy('pl_place')
            ->get();

        $list = [];
        foreach ($rows as $row) {
            // Find/count places without co-ordinates
            $children = $this->childLocationStatus((int) $row->pl_id);
            $active   = $this->isLocationActive($row->pl_place . $fqpn);

            if (!$active) {
                $badge = 'danger';
            } elseif ((int) $children->no_coord > 0) {
                $badge = 'warning';
            } elseif ((int) $children->child_count > 0) {
                $badge = 'info';
            } else {
                $badge = 'secondary';
            }

            $row->child_count = (int) $children->child_count;
            $row->badge       = $badge;

            $list[] = $row;
        }

        return $list;
    }
private function getPlaceListLocation(int $id): array
    {
        // We know the id of the place in the placelocation table,
        // now get the id of the same place in the places table
        if ($id === 0) {
            $fqpn = '';
        } else {
            $hierarchy = $this->getHierarchy($id);
            $fqpn      = ', ' . $hierarchy[0]->fqpn;
        }

        $rows = DB::table('placelocation')
            ->where('pl_parent_id', '=', $id)
            ->orderBy('pl_place')
            ->get();

        $list = [];
        foreach ($rows as $row) {
            // Find/count places without co-ordinates
            $children = $this->childLocationStatus((int) $row->pl_id);
            $active   = $this->isLocationActive($row->pl_place . $fqpn);

            if (!$active) {
                $badge = 'danger';
            } elseif ((int) $children->no_coord > 0) {
                $badge = 'warning';
            } elseif ((int) $children->child_count > 0) {
                $badge = 'info';
            } else {
                $badge = 'secondary';
            }

            $row->child_count = (int) $children->child_count;
            $row->badge       = $badge;

            $list[] = $row;
        }

        return $list;
    }
private function getPlaceListLocation ( int $ id ) : array { // We know the id of the place in the placelocation table, // now get the id of the same place in the places table if ( $ id === 0 ) { $ fqpn = '' ; } else { $ hierarchy = $ this -> getHierarchy ( $ id ) ; $ fqpn = ', ' . $ hierarchy [ 0 ] -> fqpn ; } $ rows = DB :: table ( 'placelocation' ) -> where ( 'pl_parent_id' , '=' , $ id ) -> orderBy ( 'pl_place' ) -> get ( ) ; $ list = [ ] ; foreach ( $ rows as $ row ) { // Find/count places without co-ordinates $ children = $ this -> childLocationStatus ( ( int ) $ row -> pl_id ) ; $ active = $ this -> isLocationActive ( $ row -> pl_place . $ fqpn ) ; if ( ! $ active ) { $ badge = 'danger' ; } elseif ( ( int ) $ children -> no_coord > 0 ) { $ badge = 'warning' ; } elseif ( ( int ) $ children -> child_count > 0 ) { $ badge = 'info' ; } else { $ badge = 'secondary' ; } $ row -> child_count = ( int ) $ children -> child_count ; $ row -> badge = $ badge ; $ list [ ] = $ row ; } return $ list ; }
Find all of the places in the hierarchy

@param int $id

@return stdClass[]
Find all of the places in the hierarchy