Conditions | 1 |
Paths | 1 |
Total Lines | 12 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function update(UpdateApplicantSkills $request, Applicant $applicant) |
||
21 | { |
||
22 | $skillIds = $request->validated()['skill_ids']; |
||
23 | $applicant->skills()->sync($skillIds); |
||
24 | |||
25 | // $deletedExperienceSkills = $applicant->experienceSkillsQuery()->whereNotIn('skill_id', $skillIds)->get(); |
||
26 | // I'm leaving the above line commented out for now, but if we want to do something with the |
||
27 | // deleted ExperienceSkill objects, we can retrieve them before deleting and include |
||
28 | // them in the api response. |
||
29 | $applicant->experienceSkillsQuery()->whereNotIn('skill_id', $skillIds)->delete(); |
||
30 | return [ |
||
31 | 'skill_ids' => $skillIds, |
||
32 | // 'deleted_experience_skills' => JsonResource::collection($deletedExperienceSkills), |
||
36 |