getRelationValue() публичный Метод

Get a relationship.
public getRelationValue ( string $key ) : mixed
$key string
Результат mixed
Пример #1
0
 /**
  * Get a relationship.
  *
  * @param  string $key
  * @return mixed
  */
 public function getRelationValue($key)
 {
     $return = parent::getRelationValue($key);
     if (is_null($return)) {
         $return = $this->getRelationshipFromMethod($key);
     }
     return $return;
 }
Пример #2
0
 /**
  * Special function to access $model->relation, like $user->groups, etc
  *
  * @param string $key
  *
  * @return mixed
  */
 public function getRelationValue($key)
 {
     if ($results = $this->relations[$key] ?? null) {
         return $results;
     } elseif ($relation = $this->dynamicRelation($key)) {
         return $this->relations[$key] = $relation->getResults();
     } else {
         return parent::getRelationValue($key);
     }
 }
Пример #3
0
 /**
  * Get the relation value setting the connection name
  *
  * @param string $key
  * @return mixed
  */
 public function getRelationValue($key)
 {
     $relation = parent::getRelationValue($key);
     if ($relation instanceof Collection) {
         $relation->each(function ($model) {
             $this->setRelationConnection($model);
         });
         return $relation;
     }
     $this->setRelationConnection($relation);
     return $relation;
 }