app/Http/Controllers/Admin/LocationController.php
private function isLocationActive(string $place_name): bool
    {
        $places = explode(Gedcom::PLACE_SEPARATOR, $place_name);

        $query = DB::table('places AS p0')
            ->where('p0.p_place', '=', $places[0])
            ->select(['pl0.*']);

        array_shift($places);

        foreach ($places as $n => $place) {
            $query->join('places AS p' . ($n + 1), static function (JoinClause $join) use ($n, $place): void {
                $join
                    ->on('p' . ($n + 1) . '.p_id', '=', 'p' . $n . '.p_parent_id')
                    ->where('p' . ($n + 1) . '.p_place', '=', $place);
            });
        }

        return $query->exists();
    }
private function isLocationActive(string $place_name): bool
    {
        $places = explode(Gedcom::PLACE_SEPARATOR, $place_name);

        $query = DB::table('places AS p0')
            ->where('p0.p_place', '=', $places[0])
            ->select(['pl0.*']);

        array_shift($places);

        foreach ($places as $n => $place) {
            $query->join('places AS p' . ($n + 1), static function (JoinClause $join) use ($n, $place): void {
                $join
                    ->on('p' . ($n + 1) . '.p_id', '=', 'p' . $n . '.p_parent_id')
                    ->where('p' . ($n + 1) . '.p_place', '=', $place);
            });
        }

        return $query->exists();
    }
private function isLocationActive ( string $ place_name ) : bool { $ places = explode ( Gedcom :: PLACE_SEPARATOR , $ place_name ) ; $ query = DB :: table ( 'places AS p0' ) -> where ( 'p0.p_place' , '=' , $ places [ 0 ] ) -> select ( [ 'pl0.*' ] ) ; array_shift ( $ places ) ; foreach ( $ places as $ n => $ place ) { $ query -> join ( 'places AS p' . ( $ n + 1 ) , static function ( JoinClause $ join ) use ( $ n , $ place ) : void { $ join -> on ( 'p' . ( $ n + 1 ) . '.p_id' , '=' , 'p' . $ n . '.p_parent_id' ) -> where ( 'p' . ( $ n + 1 ) . '.p_place' , '=' , $ place ) ; } ) ; } return $ query -> exists ( ) ; }
Is a place name used in any tree?

@param string $place_name

@return bool
Is a place name used in any tree?