@@ 396-402 (lines=7) @@ | ||
393 | $relations = explode('.', $path); |
|
394 | $count = count($relations); |
|
395 | ||
396 | if ($count === 1) { |
|
397 | $attribute = $model->getAttribute($this->getModelAttributeKey()); |
|
398 | ||
399 | if (! empty($attribute) || $attribute === 0 || is_null($value)) { |
|
400 | return $attribute; |
|
401 | } |
|
402 | } |
|
403 | ||
404 | foreach ($relations as $relation) { |
|
405 | if ($model->{$relation} instanceof Model) { |
|
@@ 410-416 (lines=7) @@ | ||
407 | continue; |
|
408 | } |
|
409 | ||
410 | if ($count === 2) { |
|
411 | $attribute = $model->getAttribute($relation); |
|
412 | ||
413 | if (! empty($attribute) || is_null($value)) { |
|
414 | return $attribute; |
|
415 | } |
|
416 | } |
|
417 | ||
418 | if (is_null($this->getDefaultValue())) { |
|
419 | throw new LogicException("Can not fetch value for field '{$path}'. Probably relation definition is incorrect"); |