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


PHP Collection::__construct方法代码示例

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


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

示例1: __construct

 /**
  * MetaItemCollection constructor.
  *
  * @param array $items
  */
 public function __construct($items = [])
 {
     parent::__construct($items);
     $this->original_model_keys = $this->modelKeys();
     $this->setTags($this->items);
     $this->observeDeletions($this->items);
 }
开发者ID:boxedcode,项目名称:laravel-eloquent-meta,代码行数:12,代码来源:MetaItemCollection.php

示例2: __construct

 public function __construct($items)
 {
     parent::__construct($items);
     foreach ($items as $role) {
         $this->roles[$role->id] = $role->name;
         $this->permissions = array_merge($this->permissions, $role->getPermissionsArray());
     }
 }
开发者ID:lewiatan,项目名称:rbac,代码行数:8,代码来源:RolesCollection.php

示例3: __construct

 public function __construct($items = [])
 {
     $posts = [];
     foreach ($items as $item) {
         $posts[] = Post::resolveWordPressPostToModel($item);
     }
     parent::__construct($posts);
 }
开发者ID:ericbarnes,项目名称:framework,代码行数:8,代码来源:Loop.php

示例4: __construct

 /**
  * Constructor.
  * @param array $items
  */
 public function __construct($items = [])
 {
     parent::__construct($items);
     foreach ($this->items as $input) {
         if (!$this->class) {
             $this->class = $input->object;
         }
         $this->fields[$input->name] = $input;
     }
 }
开发者ID:breachofmind,项目名称:birdmin,代码行数:14,代码来源:InputCollection.php

示例5: __construct

 public function __construct($models)
 {
     if ($models instanceof UploadCollection) {
         $medias = $this;
         $models->each(function ($upload) use($medias) {
             $medias->push($upload);
         });
     } else {
         parent::__construct($models);
     }
 }
开发者ID:escapework,项目名称:laramedias,代码行数:11,代码来源:MediaCollection.php

示例6: __construct

 /**
  * Create a new instance containing Elasticsearch results
  *
  * @todo Remove backwards compatible detection at further point
  * @deprecated Initialize with params ($results, $instance) is deprecated,
  *    please use Model::hydrateElasticsearchResult($results).
  *
  * @param  mixed  $items
  * @param  array  $meta
  * @return void
  */
 public function __construct($items, $meta = null)
 {
     // Detect if arguments are old deprecated version ($results, $instance)
     if (isset($items['hits']) and $meta instanceof \Illuminate\Database\Eloquent\Model) {
         $instance = $meta;
         $meta = $items;
         $items = $instance::hydrateElasticsearchResult($meta);
     }
     parent::__construct($items);
     // Take our result meta and map it
     // to some class properties.
     if (is_array($meta)) {
         $this->setMeta($meta);
     }
 }
开发者ID:uniring,项目名称:elasticquent,代码行数:26,代码来源:ElasticquentResultCollection.php

示例7: foreach

 /**
  * Convert all file types to url paths
  */
 function __construct($models)
 {
     foreach ($models as $model) {
         if (isset($model->files)) {
             foreach ($model->files as $file) {
                 $method = camel_case($file);
                 try {
                     $model[$file] = $model->{$method}();
                 } catch (\BadMethodCallException $e) {
                     $model[$file] = $model::Uploader()->get($model[$file]);
                 }
             }
         }
     }
     return parent::__construct($models);
 }
开发者ID:luizgabriel,项目名称:infire,代码行数:19,代码来源:InfireCollection.php

示例8: __construct

 public function __construct(array $items = array(), $parentKey = 'parent_id')
 {
     parent::__construct($items);
     $this->total = count($items);
     $this->parentKey = $parentKey;
 }
开发者ID:hilmysyarif,项目名称:phpv8,代码行数:6,代码来源:NestableCollection.php

示例9: __construct

 public function __construct($items = [])
 {
     parent::__construct($items);
     $this->parentColumn = 'parent_id';
     $this->total = count($items);
 }
开发者ID:webfactorybulgaria,项目名称:NestableCollection,代码行数:6,代码来源:NestableCollection.php

示例10: __construct

 public function __construct(array $items = array())
 {
     parent::__construct($items);
     $this->total = count($items);
 }
开发者ID:mrkodssldrf,项目名称:TypiCMS,代码行数:5,代码来源:NestedCollection.php

示例11: __construct

 /**
  * Create a new collection.
  *
  * @param  mixed $items
  * @param string|null $className
  */
 public function __construct($items = [], $className = null)
 {
     parent::__construct($items);
     $this->className = $className;
 }
开发者ID:spira,项目名称:api-core,代码行数:11,代码来源:Collection.php

示例12: __construct

 /**
  * Constructor.
  * @param array $items
  */
 public function __construct($items = [])
 {
     parent::__construct($items);
 }
开发者ID:breachofmind,项目名称:birdmin,代码行数:8,代码来源:MediaCollection.php

示例13: __construct

 /**
  * Constructor.
  * @param array $items
  */
 public function __construct($items = [])
 {
     parent::__construct($items);
     $this->index();
 }
开发者ID:breachofmind,项目名称:birdmin,代码行数:9,代码来源:PermissionCollection.php

示例14: __construct

 /**
  * Constructor.
  * @param array $items
  */
 public function __construct($items = [])
 {
     parent::__construct($items);
     array_map([$this, 'add'], $items);
 }
开发者ID:breachofmind,项目名称:birdmin,代码行数:9,代码来源:MetaCollection.php

示例15: __construct

 /**
  * @param array $models
  */
 public function __construct($models)
 {
     parent::__construct($models);
 }
开发者ID:fenos,项目名称:notifynder,代码行数:7,代码来源:NotifynderCollection.php


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