| Conditions | 3 |
| Paths | 4 |
| Total Lines | 26 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function updateForApplication(Request $request, JobApplication $application) |
||
| 21 | { |
||
| 22 | $request->validate([ |
||
| 23 | 'review_status_id' => [ |
||
| 24 | 'nullable', |
||
| 25 | Rule::in(ReviewStatus::all()->pluck('id')->toArray()) |
||
| 26 | ], |
||
| 27 | 'notes' => 'nullable|string' |
||
| 28 | ]); |
||
| 29 | |||
| 30 | $review = $application->application_review; |
||
| 31 | if ($review === null) { |
||
| 32 | $review = new ApplicationReview(); |
||
| 33 | $review->job_application()->associate($application); |
||
| 34 | } |
||
| 35 | $review->fill([ |
||
| 36 | 'review_status_id' => $request->input('review_status_id'), |
||
| 37 | 'notes' => $request->input('notes'), |
||
| 38 | ]); |
||
| 39 | $review->save(); |
||
| 40 | |||
| 41 | if ($request->ajax()) { |
||
| 42 | return $review->fresh()->toJson(); |
||
| 43 | } |
||
| 44 | |||
| 45 | return redirect()->back(); |
||
|
|
|||
| 46 | } |
||
| 48 |