@@ -16,7 +16,7 @@ discard block  | 
                                                    ||
| 16 | 16 | public function __construct()  | 
                                                        
| 17 | 17 |      { | 
                                                        
| 18 | 18 |          $this->middleware('auth'); | 
                                                        
| 19 | -        $this->middleware(function ($request, $next) { | 
                                                        |
| 19 | +        $this->middleware(function($request, $next) { | 
                                                        |
| 20 | 20 |              $this->authorize('hasAccess', 'Manage Customers'); | 
                                                        
| 21 | 21 | return $next($request);  | 
                                                        
| 22 | 22 | });  | 
                                                        
@@ -50,14 +50,14 @@ discard block  | 
                                                    ||
| 50 | 50 | // Form to view what kind of file types can be assigned to customers  | 
                                                        
| 51 | 51 | public function fileTypes()  | 
                                                        
| 52 | 52 |      { | 
                                                        
| 53 | -        Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); | 
                                                        |
| 53 | +        Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); | 
                                                        |
| 54 | 54 |          return view('admin.customerFileTypes'); | 
                                                        
| 55 | 55 | }  | 
                                                        
| 56 | 56 | |
| 57 | 57 | // Get the types of files that can be assigned to a customer file  | 
                                                        
| 58 | 58 | public function getFileTypes()  | 
                                                        
| 59 | 59 |      { | 
                                                        
| 60 | -        Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); | 
                                                        |
| 60 | +        Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); | 
                                                        |
| 61 | 61 | |
| 62 | 62 | $types = new CustomerFileTypesCollection(CustomerFileTypes::all());  | 
                                                        
| 63 | 63 | |
@@ -68,7 +68,7 @@ discard block  | 
                                                    ||
| 68 | 68 | // Submit a new file type name  | 
                                                        
| 69 | 69 | public function submitNewFileType(Request $request)  | 
                                                        
| 70 | 70 |      { | 
                                                        
| 71 | -        Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name . '. Submitted Data - ', $request->toArray()); | 
                                                        |
| 71 | +        Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name.'. Submitted Data - ', $request->toArray()); | 
                                                        |
| 72 | 72 | $request->validate([  | 
                                                        
| 73 | 73 | 'name' => 'required',  | 
                                                        
| 74 | 74 | ]);  | 
                                                        
@@ -77,14 +77,14 @@ discard block  | 
                                                    ||
| 77 | 77 | 'description' => $request->name,  | 
                                                        
| 78 | 78 | ]);  | 
                                                        
| 79 | 79 | |
| 80 | -        Log::notice('New Customer File Type ' . $request->name . ' created by '. Auth::user()->full_name); | 
                                                        |
| 80 | +        Log::notice('New Customer File Type '.$request->name.' created by '.Auth::user()->full_name); | 
                                                        |
| 81 | 81 | return response()->json(['success' => true]);  | 
                                                        
| 82 | 82 | }  | 
                                                        
| 83 | 83 | |
| 84 | 84 | // Update the name of a file type  | 
                                                        
| 85 | 85 | public function setFileTypes(Request $request)  | 
                                                        
| 86 | 86 |      { | 
                                                        
| 87 | -        Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name . '. Submitted Data - ', $request->toArray()); | 
                                                        |
| 87 | +        Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name.'. Submitted Data - ', $request->toArray()); | 
                                                        |
| 88 | 88 | $request->validate([  | 
                                                        
| 89 | 89 | 'name' => 'required',  | 
                                                        
| 90 | 90 | 'id' => 'required|exists:customer_file_types,file_type_id',  | 
                                                        
@@ -101,14 +101,14 @@ discard block  | 
                                                    ||
| 101 | 101 | // Try to delete a file type  | 
                                                        
| 102 | 102 | public function delFileType($id)  | 
                                                        
| 103 | 103 |      { | 
                                                        
| 104 | -        Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); | 
                                                        |
| 104 | +        Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); | 
                                                        |
| 105 | 105 | |
| 106 | 106 |          try { | 
                                                        
| 107 | 107 | // Try to delete file type from database - will throw error if foreign key is in use  | 
                                                        
| 108 | 108 | CustomerFileTypes::find($id)->delete();  | 
                                                        
| 109 | -        } catch (\Illuminate\Database\QueryException $e) { | 
                                                        |
| 109 | +        } catch(\Illuminate\Database\QueryException $e) { | 
                                                        |
| 110 | 110 | // Unable to remove file type from the database  | 
                                                        
| 111 | -            Log::warning('Attempt to delete file type ID '.$id.' by User '.Auth::user()->full_name.' failed.  Reason - ' . $e); | 
                                                        |
| 111 | +            Log::warning('Attempt to delete file type ID '.$id.' by User '.Auth::user()->full_name.' failed.  Reason - '.$e); | 
                                                        |
| 112 | 112 | return response()->json(['success' => false, 'reason' => 'In Use']);  | 
                                                        
| 113 | 113 | }  | 
                                                        
| 114 | 114 | |
@@ -119,7 +119,7 @@ discard block  | 
                                                    ||
| 119 | 119 | // Show all disabled customers  | 
                                                        
| 120 | 120 | public function showDisabled()  | 
                                                        
| 121 | 121 |      { | 
                                                        
| 122 | -        Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); | 
                                                        |
| 122 | +        Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); | 
                                                        |
| 123 | 123 | |
| 124 | 124 |          $custList = Customers::select('cust_id', 'name', 'deleted_at') | 
                                                        
| 125 | 125 | ->onlyTrashed()  | 
                                                        
@@ -133,7 +133,7 @@ discard block  | 
                                                    ||
| 133 | 133 | // Re-enable a customer  | 
                                                        
| 134 | 134 | public function enableCustomer($id)  | 
                                                        
| 135 | 135 |      { | 
                                                        
| 136 | -        Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); | 
                                                        |
| 136 | +        Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); | 
                                                        |
| 137 | 137 | |
| 138 | 138 |          Customers::withTrashed()->where('cust_id', $id)->restore(); | 
                                                        
| 139 | 139 | |
@@ -103,10 +103,13 @@  | 
                                                    ||
| 103 | 103 |      { | 
                                                        
| 104 | 104 |          Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); | 
                                                        
| 105 | 105 | |
| 106 | -        try { | 
                                                        |
| 106 | + try  | 
                                                        |
| 107 | +        { | 
                                                        |
| 107 | 108 | // Try to delete file type from database - will throw error if foreign key is in use  | 
                                                        
| 108 | 109 | CustomerFileTypes::find($id)->delete();  | 
                                                        
| 109 | -        } catch (\Illuminate\Database\QueryException $e) { | 
                                                        |
| 110 | + }  | 
                                                        |
| 111 | + catch (\Illuminate\Database\QueryException $e)  | 
                                                        |
| 112 | +        { | 
                                                        |
| 110 | 113 | // Unable to remove file type from the database  | 
                                                        
| 111 | 114 |              Log::warning('Attempt to delete file type ID '.$id.' by User '.Auth::user()->full_name.' failed.  Reason - ' . $e); | 
                                                        
| 112 | 115 | return response()->json(['success' => false, 'reason' => 'In Use']);  |