app/Http/Controllers/Admin/MediaController.php
private function allMediaFolders(): Collection
    {
        $base_folders = DB::table('gedcom_setting')
            ->where('setting_name', '=', 'MEDIA_DIRECTORY')
            ->select(DB::raw("setting_value || 'dummy.jpeg' AS path"));

        return DB::table('media_file')
            ->join('gedcom_setting', 'gedcom_id', '=', 'm_file')
            ->where('setting_name', '=', 'MEDIA_DIRECTORY')
            ->where('multimedia_file_refn', 'LIKE', '%/%')
            ->where('multimedia_file_refn', 'NOT LIKE', 'http://%')
            ->where('multimedia_file_refn', 'NOT LIKE', 'https://%')
            ->select(DB::raw('setting_value || multimedia_file_refn AS path'))
            ->union($base_folders)
            ->pluck('path')
            ->map(static function (string $path): string {
                return dirname($path) . '/';
            })
            ->unique()
            ->sort()
            ->mapWithKeys(static function (string $path): array {
                return [$path => $path];
            });
    }
private function allMediaFolders(): Collection
    {
        $base_folders = DB::table('gedcom_setting')
            ->where('setting_name', '=', 'MEDIA_DIRECTORY')
            ->select(DB::raw("setting_value || 'dummy.jpeg' AS path"));

        return DB::table('media_file')
            ->join('gedcom_setting', 'gedcom_id', '=', 'm_file')
            ->where('setting_name', '=', 'MEDIA_DIRECTORY')
            ->where('multimedia_file_refn', 'LIKE', '%/%')
            ->where('multimedia_file_refn', 'NOT LIKE', 'http://%')
            ->where('multimedia_file_refn', 'NOT LIKE', 'https://%')
            ->select(DB::raw('setting_value || multimedia_file_refn AS path'))
            ->union($base_folders)
            ->pluck('path')
            ->map(static function (string $path): string {
                return dirname($path) . '/';
            })
            ->unique()
            ->sort()
            ->mapWithKeys(static function (string $path): array {
                return [$path => $path];
            });
    }
private function allMediaFolders ( ) : Collection { $ base_folders = DB :: table ( 'gedcom_setting' ) -> where ( 'setting_name' , '=' , 'MEDIA_DIRECTORY' ) -> select ( DB :: raw ( "setting_value || 'dummy.jpeg' AS path" ) ) ; return DB :: table ( 'media_file' ) -> join ( 'gedcom_setting' , 'gedcom_id' , '=' , 'm_file' ) -> where ( 'setting_name' , '=' , 'MEDIA_DIRECTORY' ) -> where ( 'multimedia_file_refn' , 'LIKE' , '%/%' ) -> where ( 'multimedia_file_refn' , 'NOT LIKE' , 'http://%' ) -> where ( 'multimedia_file_refn' , 'NOT LIKE' , 'https://%' ) -> select ( DB :: raw ( 'setting_value || multimedia_file_refn AS path' ) ) -> union ( $ base_folders ) -> pluck ( 'path' ) -> map ( static function ( string $ path ) : string { return dirname ( $ path ) . '/' ; } ) -> unique ( ) -> sort ( ) -> mapWithKeys ( static function ( string $ path ) : array { return [ $ path => $ path ] ; } ) ; }
Generate a list of all folders from all the trees.

@return Collection
@return string[]
Generate a list of all folders from all the trees .