Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2.351 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
41 | 1 | public function update(CustIdRequest $request, $id) |
|
42 | { |
||
43 | 1 | $cust = Customer::findOrFail($id); |
|
44 | |||
45 | try{ |
||
46 | 1 | $cust->update($request->only(['cust_id'])); |
|
47 | } |
||
48 | catch(QueryException $e) |
||
49 | { |
||
50 | Log::error('Update Customer ID failed'); |
||
51 | Log::error($e); |
||
52 | return redirect()->back()->with(['message' => 'Unable to Update Customer ID for linked Customers', 'type' => 'danger']); |
||
53 | } |
||
54 | |||
55 | 1 | Log::channel('cust')->notice('Customer ID has been updated for Customer '.$cust->name.' from '.$id.' to '.$request->cust_id.' by '.$request->user()->username); |
|
56 | 1 | return redirect()->route('admin.index'); |
|
57 | } |
||
59 |