src/Gzero/Cms/Repositories/ContentReadRepository.php
public function getAncestorsTitlesAndPaths(Content $content, Language $language, $onlyActive = true)
    {
        $ancestorIds = array_filter(explode('/', $content->path));
        return \DB::table('contents as c')
            ->join('routes as r', function ($join) use ($language, $onlyActive) {
                $join->on('c.id', '=', 'r.routable_id')
                    ->where('r.routable_type', '=', Content::class)
                    ->where('r.language_code', $language->code)
                    ->when($onlyActive, function ($query) {
                        $query->where('r.is_active', true);
                    });
            })
            ->join('content_translations as ct', function ($join) use ($language, $onlyActive) {
                $join->on('c.id', '=', 'ct.content_id')->where('ct.language_code', $language->code)
                    ->when($onlyActive, function ($query) {
                        $query->where('ct.is_active', true);
                    });
            })
            ->whereIn('c.id', $ancestorIds)
            ->orderBy('level', 'ASC')
            ->select(['ct.title', 'r.path'])
            ->get();
    }
public function getAncestorsTitlesAndPaths(Content $content, Language $language, $onlyActive = true)
    {
        $ancestorIds = array_filter(explode('/', $content->path));
        return \DB::table('contents as c')
            ->join('routes as r', function ($join) use ($language, $onlyActive) {
                $join->on('c.id', '=', 'r.routable_id')
                    ->where('r.routable_type', '=', Content::class)
                    ->where('r.language_code', $language->code)
                    ->when($onlyActive, function ($query) {
                        $query->where('r.is_active', true);
                    });
            })
            ->join('content_translations as ct', function ($join) use ($language, $onlyActive) {
                $join->on('c.id', '=', 'ct.content_id')->where('ct.language_code', $language->code)
                    ->when($onlyActive, function ($query) {
                        $query->where('ct.is_active', true);
                    });
            })
            ->whereIn('c.id', $ancestorIds)
            ->orderBy('level', 'ASC')
            ->select(['ct.title', 'r.path'])
            ->get();
    }
public function getAncestorsTitlesAndPaths ( Content $ content , Language $ language , $ onlyActive = true ) { $ ancestorIds = array_filter ( explode ( '/' , $ content -> path ) ) ; return \ DB :: table ( 'contents as c' ) -> join ( 'routes as r' , function ( $ join ) use ( $ language , $ onlyActive ) { $ join -> on ( 'c.id' , '=' , 'r.routable_id' ) -> where ( 'r.routable_type' , '=' , Content :: class ) -> where ( 'r.language_code' , $ language -> code ) -> when ( $ onlyActive , function ( $ query ) { $ query -> where ( 'r.is_active' , true ) ; } ) ; } ) -> join ( 'content_translations as ct' , function ( $ join ) use ( $ language , $ onlyActive ) { $ join -> on ( 'c.id' , '=' , 'ct.content_id' ) -> where ( 'ct.language_code' , $ language -> code ) -> when ( $ onlyActive , function ( $ query ) { $ query -> where ( 'ct.is_active' , true ) ; } ) ; } ) -> whereIn ( 'c.id' , $ ancestorIds ) -> orderBy ( 'level' , 'ASC' ) -> select ( [ 'ct.title' , 'r.path' ] ) -> get ( ) ; }
Returns titles & url paths from ancestors

@param Content  $content    Content
@param Language $language   Language
@param bool     $onlyActive isActive trigger

@return \Illuminate\Support\Collection
Returns titles & url paths from ancestors