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


PHP Collection::__construct方法代码示例

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


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

示例1: __construct

 public function __construct(string $name, array $options = [])
 {
     parent::__construct();
     $this->name = $name;
     $this->caption = $options['caption'] ?? $name;
     $this->priority = $options['priority'] ?? $this->priority;
 }
开发者ID:rabbitcms,项目名称:settings,代码行数:7,代码来源:Group.php

示例2: __construct

 public function __construct($items = [])
 {
     $this->storagePath = storage_path('logs');
     $this->filesystem = new Filesystem(app('files'), $this->storagePath);
     parent::__construct($items);
     $this->load();
 }
开发者ID:TheOrchid,项目名称:Dashboard,代码行数:7,代码来源:Log.php

示例3: __construct

 /**
  * Construct a collection of Result objects based on the hits
  * in the Elasticsearch response
  *
  * @param Response $response
  */
 public function __construct(Response $response)
 {
     $this->response = $response;
     parent::__construct(array_map(function ($hit) {
         return new Result($hit);
     }, $this->response->getHits()));
 }
开发者ID:geekybeaver,项目名称:larasearch,代码行数:13,代码来源:Results.php

示例4: __construct

 public function __construct(array $entities = null)
 {
     if ($entities) {
         $this->checkItemsAreMappable($entities);
     }
     parent::__construct($entities);
 }
开发者ID:maxmirazh33,项目名称:analogue,代码行数:7,代码来源:EntityCollection.php

示例5: __construct

 public function __construct($items = null)
 {
     if (is_null($items)) {
         return parent::__construct(config('amazon.mws'));
     }
     return parent::__construct($items);
 }
开发者ID:ireisaac,项目名称:mws,代码行数:7,代码来源:Collection.php

示例6: __construct

 /**
  * @inheritdoc
  */
 public function __construct($items = null, $class_slug = null, $key_by = null)
 {
     $items = is_null($items) ? [] : $items;
     if ($items instanceof \Illuminate\Support\Collection) {
         return parent::__construct($items);
     }
     if ($class_slug) {
         $items = array_map(function ($item) use($class_slug) {
             if (is_null($item)) {
                 return $item;
             }
             if (!is_array($item)) {
                 throw new \Exception("Failed to cast a model");
             }
             $class = Model::getModelClass($class_slug);
             return new $class($item);
         }, $items);
     }
     if ($key_by) {
         $items = array_build($items, function ($key, $value) use($key_by) {
             /** @var Model $value */
             $key = $value instanceof Model ? $value->get($key_by) : data_get($value, $key_by);
             return [$key, $value];
         });
     }
     return parent::__construct($items);
 }
开发者ID:sourcestream,项目名称:highcore-api,代码行数:30,代码来源:Collection.php

示例7: __construct

 /**
  * Create a new article collection instance.
  * 
  * @param  \JasonLewis\Website\Loader  $loader
  * @param  \Illuminate\Cache\CacheManager  $cache
  * @param  int  $expires
  * @param  array  $items
  * @return void
  */
 public function __construct(Loader $loader, CacheManager $cache, $expires, $items = [])
 {
     $this->loader = $loader;
     $this->cache = $cache;
     $this->expires = $expires;
     parent::__construct($items);
 }
开发者ID:bamper,项目名称:website,代码行数:16,代码来源:Collection.php

示例8: __construct

 public function __construct(array $messages = [])
 {
     $messageModels = [];
     foreach ($messages as $message) {
         $messageModels[] = new Model($message);
     }
     parent::__construct($messageModels);
 }
开发者ID:agouticreative,项目名称:laravel-mailcatcher,代码行数:8,代码来源:Collection.php

示例9: __construct

 public function __construct($opt = [])
 {
     $opt = $this->convertOptions($opt);
     $options = $opt;
     $options['chart'] = new ChartPropertie(isset($options['chart']) ? $options['chart'] : []);
     parent::__construct($options);
     $this->resolveID($opt);
 }
开发者ID:1161869797,项目名称:CanvasJS,代码行数:8,代码来源:Chart.php

示例10: __construct

 /**
  * @param array $params
  */
 public function __construct(array $params = array())
 {
     foreach ($params['profiles'] as &$profile) {
         $profile = new Subscription($profile);
     }
     parent::__construct($params['profiles']);
     unset($params);
 }
开发者ID:sullivandavid42,项目名称:php-withings,代码行数:11,代码来源:SubscriptionCollection.php

示例11: __construct

 /**
  * @param ServiceInterface[] $items
  */
 public function __construct($items = [])
 {
     $items = is_array($items) ? $items : $this->getArrayableItems($items);
     foreach ($items as $index => $item) {
         $this->checkValidService($item);
     }
     parent::__construct($items);
 }
开发者ID:czim,项目名称:laravel-service,代码行数:11,代码来源:ServiceCollection.php

示例12: __construct

 public function __construct(array $params = array())
 {
     $this->updatedAt = Carbon::createFromTimestamp($params['updatetime'], $params['timezone']);
     foreach ($params['measuregrps'] as &$group) {
         $group = new Measure($group);
     }
     parent::__construct($params['measuregrps']);
     unset($params);
 }
开发者ID:sullivandavid42,项目名称:php-withings,代码行数:9,代码来源:MeasureCollection.php

示例13: __construct

 /**
  * Create a new ContentItem.
  *
  *
  * @param array $items
  *
  * @throws MissingParameterContentItemException
  */
 public function __construct($items = [])
 {
     //New Up parent
     parent::__construct($items);
     //If we do not have content then throw an Exception
     if (!$this->has('content')) {
         throw new MissingParameterContentItemException('Personality Insights requires a content', 422);
     }
 }
开发者ID:findbrok,项目名称:laravel-personality-insights,代码行数:17,代码来源:ContentItem.php

示例14: __construct

 /**
  * Construct a collection of Eloquent models based on the search result
  *
  * @access public
  * @param Response $response
  */
 public function __construct(Response $response)
 {
     $this->response = $response;
     $ids = array_map(function ($hit) {
         return $hit['_id'];
     }, $this->response->getHits());
     $model = $response->getModel();
     parent::__construct($model::whereIn('id', $ids)->get()->toArray());
 }
开发者ID:menthol,项目名称:Flexible,代码行数:15,代码来源:Records.php

示例15: __construct

 public function __construct($creds)
 {
     $this->connection = new PexConnection($creds);
     $accountlist = $this->connection->allAccounts();
     $items = array();
     foreach ($accountlist as $act) {
         $items[] = new Account($this->connection, $act);
     }
     parent::__construct($items);
 }
开发者ID:kevin-cole,项目名称:pex-php,代码行数:10,代码来源:AccountCollection.php


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