load() public method

Eager load relations on the model.
public load ( array | string $relations )
$relations array | string
 public function apply(Model $model, Repository $repository)
 {
     return $model->load($this->relations);
 }
 /**
  * Load settings from the resource relationship on to this.
  */
 protected function sync()
 {
     $this->resource->load('propertyBag');
     $this->settings = $this->getAllSettingsFlat();
 }
Beispiel #3
0
 /**
  * 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;
 }
Beispiel #4
0
 /**
  * Find inner relations and load them on target model.
  *
  * @param Model|\Illuminate\Database\Eloquent\Collection $loadee
  *
  * @return void
  */
 protected function loadRelations($loadee)
 {
     $relations = $this->reference->relations();
     if ($relations) {
         $loadee->load($relations);
     }
 }