Conditions | 3 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
44 | protected function parseRows(Collection $rows) |
||
45 | { |
||
46 | if (is_null($pathKey = $this->getImagePathAttribute())) { |
||
47 | throw new \InvalidArgumentException('Must set image attribute'); |
||
48 | } |
||
49 | |||
50 | return $rows->map(function (Model $row) use ($pathKey) { |
||
51 | if (!isset($row->$pathKey)) { |
||
52 | throw new \InvalidArgumentException("Not Found '{$pathKey}' attribute"); |
||
53 | } |
||
54 | $row->setAttribute('_primary', $row->getKey()); |
||
55 | $row->setAttribute('_url', $this->getUrl($row->$pathKey)); |
||
56 | return $row; |
||
57 | }); |
||
58 | } |
||
59 | |||
71 |