コード例 #1
0
ファイル: Factory.php プロジェクト: dkulyk/eloquent-extra
 /**
  * Get all property values.
  *
  * @param string|bool $need
  *
  * @return Collection
  */
 public function getPropertyValues($need = false)
 {
     //load another values if don`t exist
     if ($this->loaded !== true && $need !== false && !in_array($need, $this->loaded, true)) {
         $properties = $this->properties->filter(function ($property, $name) {
             return !in_array($name, $this->loaded, true);
         });
         $this->loaded = true;
         if ($properties->count()) {
             $this->entity->load(['values' => function (Properties\Relations\Values $relation) use($properties) {
                 $relation->setProperties($properties);
             }]);
         }
     }
     return $this->values;
 }