| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 1 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | 2 | protected function addParent($cust, $parent) |
|
| 33 | { |
||
| 34 | // Determine if the selected Parent ID has a parent ID of its own |
||
| 35 | $p = Customer::findOrFail($parent); |
||
| 36 | if($p->parent_id) |
||
| 37 | { |
||
| 38 | $parent = $p->parent_id; |
||
| 39 | } |
||
| 40 | |||
| 41 | Customer::find($cust)->update([ |
||
| 42 | 'parent_id' => $parent, |
||
| 43 | ]); |
||
| 44 | |||
| 45 | event(new CustomerLinkedEvent($cust, true)); |
||
| 46 | return [ |
||
| 47 | 'message' => 'Customer successfully linked', |
||
| 48 | 'type' => 'success', |
||
| 49 | ]; |
||
| 66 |