app/Http/Controllers/AdminTreesController.php
private function generateNewTreeName(): string
    {
        $tree_name      = 'tree';
        $tree_number    = 1;
        $existing_trees = Tree::getNameList();

        while (array_key_exists($tree_name . $tree_number, $existing_trees)) {
            $tree_number++;
        }

        return $tree_name . $tree_number;
    }
private function generateNewTreeName(): string
    {
        $tree_name      = 'tree';
        $tree_number    = 1;
        $existing_trees = Tree::getNameList();

        while (array_key_exists($tree_name . $tree_number, $existing_trees)) {
            $tree_number++;
        }

        return $tree_name . $tree_number;
    }
private function generateNewTreeName ( ) : string { $ tree_name = 'tree' ; $ tree_number = 1 ; $ existing_trees = Tree :: getNameList ( ) ; while ( array_key_exists ( $ tree_name . $ tree_number , $ existing_trees ) ) { $ tree_number ++ ; } return $ tree_name . $ tree_number ; }
Generate a unqiue name for new trees

@return string
Generate a unqiue name for new trees