src/controllers/BaseController.php
public function showResource($name)
    {
        $options = Config::get('laravel-swagger::getResourceOptions');
        $resourceName = "/" . str_replace("-", "/", $name);

        $excludedPath = Config::get('laravel-swagger::excludedPath');
        $swagger = new Swagger($this->getPaths(), $excludedPath);

        if (Config::get('laravel-swagger::cache') && Cache::has('resource_'.$resourceName)) {
            $resource = Cache::get('resource_'.$resourceName);
        } else {
            if (!in_array($resourceName, $swagger->getResourceNames())) {
                App::abort(404, 'Resource not found');
            }

            // Pet demo uses the main laravel-swagger route.
            if ($resourceName == '/petdemo') {
                $options['defaultBasePath'] = route('swagger-index');
            }

            $resource = $swagger->getResource($resourceName, $options);
        }

        if (Config::get('laravel-swagger::cache') && !Cache::has('resource_'.$resourceName)) {
            Cache::put('resource_'.$resourceName, $resource, $this->getExpireAt());
        }

        return $resource;
    }
public function showResource($name)
    {
        $options = Config::get('laravel-swagger::getResourceOptions');
        $resourceName = "/" . str_replace("-", "/", $name);

        $excludedPath = Config::get('laravel-swagger::excludedPath');
        $swagger = new Swagger($this->getPaths(), $excludedPath);

        if (Config::get('laravel-swagger::cache') && Cache::has('resource_'.$resourceName)) {
            $resource = Cache::get('resource_'.$resourceName);
        } else {
            if (!in_array($resourceName, $swagger->getResourceNames())) {
                App::abort(404, 'Resource not found');
            }

            // Pet demo uses the main laravel-swagger route.
            if ($resourceName == '/petdemo') {
                $options['defaultBasePath'] = route('swagger-index');
            }

            $resource = $swagger->getResource($resourceName, $options);
        }

        if (Config::get('laravel-swagger::cache') && !Cache::has('resource_'.$resourceName)) {
            Cache::put('resource_'.$resourceName, $resource, $this->getExpireAt());
        }

        return $resource;
    }
public function showResource ( $ name ) { $ options = Config :: get ( 'laravel-swagger::getResourceOptions' ) ; $ resourceName = "/" . str_replace ( "-" , "/" , $ name ) ; $ excludedPath = Config :: get ( 'laravel-swagger::excludedPath' ) ; $ swagger = new Swagger ( $ this -> getPaths ( ) , $ excludedPath ) ; if ( Config :: get ( 'laravel-swagger::cache' ) && Cache :: has ( 'resource_' . $ resourceName ) ) { $ resource = Cache :: get ( 'resource_' . $ resourceName ) ; } else { if ( ! in_array ( $ resourceName , $ swagger -> getResourceNames ( ) ) ) { App :: abort ( 404 , 'Resource not found' ) ; } // Pet demo uses the main laravel-swagger route. if ( $ resourceName == '/petdemo' ) { $ options [ 'defaultBasePath' ] = route ( 'swagger-index' ) ; } $ resource = $ swagger -> getResource ( $ resourceName , $ options ) ; } if ( Config :: get ( 'laravel-swagger::cache' ) && ! Cache :: has ( 'resource_' . $ resourceName ) ) { Cache :: put ( 'resource_' . $ resourceName , $ resource , $ this -> getExpireAt ( ) ) ; } return $ resource ; }
Show an specific Resource
Show an specific Resource