當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。