src/Helper.php
public function getConfigList($list) {
        $records = Conf::where('config.list', $list)
                        ->leftJoin('config as p', 'config.parent_id', '=', 'p.id')
                        ->orderBy('config.parent_id')
                        ->select('config.id', 'config.parent_id', 'config.text', 'p.text as pre_text')
                        ->get();

        $out = [];
        $parent_id = [];

        if(!count($records)) return $out;

        foreach ($records as $row) {
            $mix = $row->pre_text == '' || $row->pre_text == null ? $row->text : $row->pre_text.' : '.$row->text;
            $out = array_add($out, $row->id, $mix);
            if(!in_array($row->parent_id, $parent_id)) array_push($parent_id, $row->parent_id);
        }

        foreach ($out as $key => $value) {
            if(in_array($key, $parent_id)) array_forget($out, $key);
        }

        return $out;
    }
public function getConfigList($list) {
        $records = Conf::where('config.list', $list)
                        ->leftJoin('config as p', 'config.parent_id', '=', 'p.id')
                        ->orderBy('config.parent_id')
                        ->select('config.id', 'config.parent_id', 'config.text', 'p.text as pre_text')
                        ->get();

        $out = [];
        $parent_id = [];

        if(!count($records)) return $out;

        foreach ($records as $row) {
            $mix = $row->pre_text == '' || $row->pre_text == null ? $row->text : $row->pre_text.' : '.$row->text;
            $out = array_add($out, $row->id, $mix);
            if(!in_array($row->parent_id, $parent_id)) array_push($parent_id, $row->parent_id);
        }

        foreach ($out as $key => $value) {
            if(in_array($key, $parent_id)) array_forget($out, $key);
        }

        return $out;
    }
public function getConfigList ( $ list ) { $ records = Conf :: where ( 'config.list' , $ list ) -> leftJoin ( 'config as p' , 'config.parent_id' , '=' , 'p.id' ) -> orderBy ( 'config.parent_id' ) -> select ( 'config.id' , 'config.parent_id' , 'config.text' , 'p.text as pre_text' ) -> get ( ) ; $ out = [ ] ; $ parent_id = [ ] ; if ( ! count ( $ records ) ) return $ out ; foreach ( $ records as $ row ) { $ mix = $ row -> pre_text == '' || $ row -> pre_text == null ? $ row -> text : $ row -> pre_text . ' : ' . $ row -> text ; $ out = array_add ( $ out , $ row -> id , $ mix ) ; if ( ! in_array ( $ row -> parent_id , $ parent_id ) ) array_push ( $ parent_id , $ row -> parent_id ) ; } foreach ( $ out as $ key => $ value ) { if ( in_array ( $ key , $ parent_id ) ) array_forget ( $ out , $ key ) ; } return $ out ; }
get config items
get config items