|
@@ 375-381 (lines=7) @@
|
| 372 |
|
$relations = explode('.', $path); |
| 373 |
|
$count = count($relations); |
| 374 |
|
|
| 375 |
|
if ($count === 1) { |
| 376 |
|
$attribute = $model->getAttribute($this->getModelAttributeKey()); |
| 377 |
|
|
| 378 |
|
if (! empty($attribute) || $attribute === 0 || is_null($value)) { |
| 379 |
|
return $attribute; |
| 380 |
|
} |
| 381 |
|
} |
| 382 |
|
|
| 383 |
|
foreach ($relations as $relation) { |
| 384 |
|
if ($model->{$relation} instanceof Model) { |
|
@@ 389-395 (lines=7) @@
|
| 386 |
|
continue; |
| 387 |
|
} |
| 388 |
|
|
| 389 |
|
if ($count === 2) { |
| 390 |
|
$attribute = $model->getAttribute($relation); |
| 391 |
|
|
| 392 |
|
if (! empty($attribute) or is_null($value)) { |
| 393 |
|
return $attribute; |
| 394 |
|
} |
| 395 |
|
} |
| 396 |
|
|
| 397 |
|
if (is_null($this->getDefaultValue())) { |
| 398 |
|
throw new LogicException("Can not fetch value for field '{$path}'. Probably relation definition is incorrect"); |