| 1 | <?php |
||
| 9 | class RelationshipIterator |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * The primary record. |
||
| 13 | */ |
||
| 14 | private $record; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The path to the relation. |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | private $path; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Create a new RelationshipIterator instance. |
||
| 25 | * |
||
| 26 | * @param Model $record The primary record |
||
| 27 | * @param string $path The path to the relation |
||
| 28 | * |
||
| 29 | * @throws InvalidArgumentException |
||
| 30 | */ |
||
| 31 | public function __construct($record, $path) |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Resolve the relationship from the primary record. |
||
| 43 | * |
||
| 44 | * @throws InvalidRelationPathException |
||
| 45 | * |
||
| 46 | * @return \Illuminate\Support\Collection|Model|null |
||
| 47 | */ |
||
| 48 | public function resolve() |
||
| 58 | } |
||
| 59 |