src/Gzero/Cms/Repositories/ContentReadRepository.php
public function getByPath(string $path, string $languageCode, bool $onlyActive = false)
    {
        return Content::query()
            ->with(self::$loadRelations)
            ->join('routes', function ($join) use ($languageCode, $path, $onlyActive) {
                $join->on('contents.id', '=', 'routes.routable_id')
                    ->where('routes.routable_type', '=', Content::class)
                    ->where('routes.language_code', $languageCode)
                    ->where('routes.path', $path)
                    ->when($onlyActive, function ($query) {
                        $query->where('routes.is_active', true);
                    });
            })
            ->first(['contents.*']);
    }
public function getByPath(string $path, string $languageCode, bool $onlyActive = false)
    {
        return Content::query()
            ->with(self::$loadRelations)
            ->join('routes', function ($join) use ($languageCode, $path, $onlyActive) {
                $join->on('contents.id', '=', 'routes.routable_id')
                    ->where('routes.routable_type', '=', Content::class)
                    ->where('routes.language_code', $languageCode)
                    ->where('routes.path', $path)
                    ->when($onlyActive, function ($query) {
                        $query->where('routes.is_active', true);
                    });
            })
            ->first(['contents.*']);
    }
public function getByPath ( string $ path , string $ languageCode , bool $ onlyActive = false ) { return Content :: query ( ) -> with ( self :: $ loadRelations ) -> join ( 'routes' , function ( $ join ) use ( $ languageCode , $ path , $ onlyActive ) { $ join -> on ( 'contents.id' , '=' , 'routes.routable_id' ) -> where ( 'routes.routable_type' , '=' , Content :: class ) -> where ( 'routes.language_code' , $ languageCode ) -> where ( 'routes.path' , $ path ) -> when ( $ onlyActive , function ( $ query ) { $ query -> where ( 'routes.is_active' , true ) ; } ) ; } ) -> first ( [ 'contents.*' ] ) ; }
Retrieve a content by given path

@param string $path         URI path
@param string $languageCode Language code
@param bool   $onlyActive   Trigger

@return Content|mixed
Retrieve a content by given path