| Conditions | 1 |
| Paths | 1 |
| Total Lines | 9 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function toArray($request) |
||
| 18 | { |
||
| 19 | $skillArray = parent::toArray($request); |
||
| 20 | // Want to include skill category ids, not the whole objects (to save data). |
||
| 21 | unset($skillArray['skill_categories']); |
||
| 22 | return array_merge($skillArray, [ |
||
| 23 | 'skill_category_ids' => $this->when( |
||
| 24 | $this->relationLoaded('skill_categories'), |
||
| 25 | $this->skill_categories->pluck('id')->all() |
||
| 26 | ) |
||
| 30 |