Conditions | 3 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
29 | protected function parseRows(Collection $rows) |
||
30 | { |
||
31 | if (is_null($pathKey = $this->getImagePathAttribute())) { |
||
32 | throw new \InvalidArgumentException('Must set image attribute'); |
||
33 | } |
||
34 | |||
35 | return $rows->map(function (Model $row) use ($pathKey) { |
||
36 | if (!isset($row->$pathKey)) { |
||
37 | throw new \InvalidArgumentException("Not Found '{$pathKey}' attribute"); |
||
38 | } |
||
39 | $row->setAttribute('_primary', $row->getKey()); |
||
40 | $row->setAttribute('_url', $this->getFileUrl($row->$pathKey)); |
||
41 | return $row; |
||
42 | }); |
||
43 | } |
||
44 | } |
||
45 |