当前位置: 首页>>代码示例>>PHP>>正文


PHP Manager::parseExcludes方法代码示例

本文整理汇总了PHP中League\Fractal\Manager::parseExcludes方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::parseExcludes方法的具体用法?PHP Manager::parseExcludes怎么用?PHP Manager::parseExcludes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在League\Fractal\Manager的用法示例。


在下文中一共展示了Manager::parseExcludes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $source_config = __DIR__ . '/../../config/fractal.php';
     $this->mergeConfigFrom($source_config, 'fractal');
     $this->app->singleton('fractal', function ($app) {
         // retrieves configurations
         $autoload = $app['config']->get('fractal.autoload');
         $input_key = $app['config']->get('fractal.input_key');
         $exclude_key = $app['config']->get('fractal.exclude_key');
         $serializer = $app['config']->get('fractal.serializer');
         // creating fractal manager instance
         $manager = new Manager();
         $factalNamespace = 'League\\Fractal\\Serializer\\';
         $loadSerializer = class_exists($factalNamespace . $serializer) ? $factalNamespace . $serializer : $serializer;
         $manager->setSerializer(new $loadSerializer());
         if ($autoload === true and $includes = $app['request']->input($input_key)) {
             $manager->parseIncludes($includes);
         }
         if ($app['request']->has($exclude_key)) {
             $manager->parseExcludes($app['request']->input($exclude_key));
         }
         return new FractalServices($manager, $app['app']);
     });
     $this->app->alias('fractal', FractalServices::class);
     // register our command here
     $this->app['command.transformer.generate'] = $this->app->share(function ($app) {
         return new TransformerGeneratorCommand($app['config'], $app['view'], $app['files'], $app);
     });
     $this->commands('command.transformer.generate');
 }
开发者ID:cyvelnet,项目名称:laravel5-fractal,代码行数:35,代码来源:Laravel5FractalServiceProvider.php

示例2: excludes

 /**
  * excludes sub level from data transformer.
  *
  * @param string|array $excludes
  *
  * @return $this
  */
 public function excludes($excludes)
 {
     if (is_string($excludes)) {
         $excludes = explode(',', $excludes);
     }
     // when autoload is enable, we need to merge user requested includes with the predefined includes.
     if ($this->autoload and $this->request->get($this->exclude_key)) {
         $excludes = array_merge($excludes, explode(',', $this->request->get($this->exclude_key)));
     }
     $this->manager->parseExcludes($excludes);
     return $this;
 }
开发者ID:cyvelnet,项目名称:laravel5-fractal,代码行数:19,代码来源:FractalServices.php

示例3: createData

 /**
  * Create fractal data.
  *
  * @return \League\Fractal\Scope
  *
  * @throws \Spatie\Fractal\Exceptions\InvalidTransformation
  * @throws \Spatie\Fractal\Exceptions\NoTransformerSpecified
  */
 public function createData()
 {
     if (is_null($this->transformer)) {
         throw new NoTransformerSpecified();
     }
     if (!is_null($this->serializer)) {
         $this->manager->setSerializer($this->serializer);
     }
     if (!is_null($this->includes)) {
         $this->manager->parseIncludes($this->includes);
     }
     if (!is_null($this->excludes)) {
         $this->manager->parseExcludes($this->excludes);
     }
     return $this->manager->createData($this->getResource());
 }
开发者ID:spatie,项目名称:laravel-fractal,代码行数:24,代码来源:Fractal.php


注:本文中的League\Fractal\Manager::parseExcludes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。