@@ -64,7 +64,7 @@ |
||
| 64 | 64 | // Sanitize the filename to remove any illegal characters and spaces |
| 65 | 65 | protected function cleanFilename($name) |
| 66 | 66 | { |
| 67 | - $newName = str_replace(' ', '_', preg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $name)); |
|
| 67 | + $newName = str_replace(' ', '_', preg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $name)); |
|
| 68 | 68 | Log::debug('Cleaned Filename', ['original_name' => $name, 'clean_name' => $newName]); |
| 69 | 69 | |
| 70 | 70 | return $newName; |
@@ -63,8 +63,7 @@ |
||
| 63 | 63 | |
| 64 | 64 | return CustomerContact::where('cust_id', $id) |
| 65 | 65 | ->with('CustomerContactPhone.PhoneNumberType') |
| 66 | - ->when($cust->parent_id, function($q) use ($cust) |
|
| 67 | - { |
|
| 66 | + ->when($cust->parent_id, function($q) use ($cust) { |
|
| 68 | 67 | $q->orWhere('cust_id', $cust->parent_id)->where('shared', true); |
| 69 | 68 | }) |
| 70 | 69 | ->get(); |
@@ -46,8 +46,7 @@ |
||
| 46 | 46 | $cust = Customer::findOrFail($id); |
| 47 | 47 | |
| 48 | 48 | return CustomerNote::where('cust_id', $id) |
| 49 | - ->when($cust->parent_id, function($q) use ($cust) |
|
| 50 | - { |
|
| 49 | + ->when($cust->parent_id, function($q) use ($cust) { |
|
| 51 | 50 | $q->orWhere('cust_id', $cust->parent_id)->where('shared', true); |
| 52 | 51 | }) |
| 53 | 52 | ->orderBy('urgent', 'DESC') |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | Log::channel('cust')->info('New Customer - '.$request->name.' created by '.Auth::user()->full_name); |
| 55 | 55 | |
| 56 | - return redirect(route('customers.show',$newCust->slug))->with(['message' => 'New Customer Created', 'type' => 'success']); |
|
| 56 | + return redirect(route('customers.show', $newCust->slug))->with(['message' => 'New Customer Created', 'type' => 'success']); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | ->with('CustomerFile.FileUpload') |
| 82 | 82 | ->with('ParentFile.FileUpload') |
| 83 | 83 | ->firstOrFail(); |
| 84 | - $isFav = UserCustomerBookmark::where('user_id', Auth::user()->user_id) |
|
| 84 | + $isFav = UserCustomerBookmark::where('user_id', Auth::user()->user_id) |
|
| 85 | 85 | ->where('cust_id', $customer->cust_id) |
| 86 | 86 | ->count(); |
| 87 | 87 | |
@@ -90,29 +90,29 @@ discard block |
||
| 90 | 90 | 'phone_types' => PhoneNumberType::all(), |
| 91 | 91 | 'file_types' => CustomerFileType::all(), |
| 92 | 92 | 'user_functions' => [ |
| 93 | - 'fav' => $isFav, // Customer is bookmarked by the user |
|
| 94 | - 'edit' => Auth::user()->can('update', $customer), // User is allowed to edit the customers basic details |
|
| 95 | - 'manage' => Auth::user()->can('manage', $customer), // User can recover deleted items |
|
| 96 | - 'deactivate' => Auth::user()->can('delete', $customer), // User can deactivate the customer profile |
|
| 93 | + 'fav' => $isFav, // Customer is bookmarked by the user |
|
| 94 | + 'edit' => Auth::user()->can('update', $customer), // User is allowed to edit the customers basic details |
|
| 95 | + 'manage' => Auth::user()->can('manage', $customer), // User can recover deleted items |
|
| 96 | + 'deactivate' => Auth::user()->can('delete', $customer), // User can deactivate the customer profile |
|
| 97 | 97 | 'equipment' => [ |
| 98 | - 'create' => Auth::user()->can('create', CustomerEquipment::class), // If user can add equipment |
|
| 99 | - 'update' => Auth::user()->can('update', CustomerEquipment::class), // If user can edit equipment |
|
| 100 | - 'delete' => Auth::user()->can('delete', CustomerEquipment::class), // If user can delete eqipment |
|
| 98 | + 'create' => Auth::user()->can('create', CustomerEquipment::class), // If user can add equipment |
|
| 99 | + 'update' => Auth::user()->can('update', CustomerEquipment::class), // If user can edit equipment |
|
| 100 | + 'delete' => Auth::user()->can('delete', CustomerEquipment::class), // If user can delete eqipment |
|
| 101 | 101 | ], |
| 102 | 102 | 'contacts' => [ |
| 103 | - 'create' => Auth::user()->can('create', CustomerContact::class), // If user can add contact |
|
| 104 | - 'update' => Auth::user()->can('update', CustomerContact::class), // If user can edit contact |
|
| 105 | - 'delete' => Auth::user()->can('delete', CustomerContact::class), // If user can delete contact |
|
| 103 | + 'create' => Auth::user()->can('create', CustomerContact::class), // If user can add contact |
|
| 104 | + 'update' => Auth::user()->can('update', CustomerContact::class), // If user can edit contact |
|
| 105 | + 'delete' => Auth::user()->can('delete', CustomerContact::class), // If user can delete contact |
|
| 106 | 106 | ], |
| 107 | 107 | 'notes' => [ |
| 108 | - 'create' => Auth::user()->can('create', CustomerNote::class), // If user can add note |
|
| 109 | - 'update' => Auth::user()->can('update', CustomerNote::class), // If user can edit note |
|
| 110 | - 'delete' => Auth::user()->can('delete', CustomerNote::class), // If user can delete note |
|
| 108 | + 'create' => Auth::user()->can('create', CustomerNote::class), // If user can add note |
|
| 109 | + 'update' => Auth::user()->can('update', CustomerNote::class), // If user can edit note |
|
| 110 | + 'delete' => Auth::user()->can('delete', CustomerNote::class), // If user can delete note |
|
| 111 | 111 | ], |
| 112 | 112 | 'files' => [ |
| 113 | - 'create' => Auth::user()->can('create', CustomerFile::class), // If user can add file |
|
| 114 | - 'update' => Auth::user()->can('update', CustomerFile::class), // If user can edit file |
|
| 115 | - 'delete' => Auth::user()->can('delete', CustomerFile::class), // If user can delete file |
|
| 113 | + 'create' => Auth::user()->can('create', CustomerFile::class), // If user can add file |
|
| 114 | + 'update' => Auth::user()->can('update', CustomerFile::class), // If user can edit file |
|
| 115 | + 'delete' => Auth::user()->can('delete', CustomerFile::class), // If user can delete file |
|
| 116 | 116 | ], |
| 117 | 117 | ], |
| 118 | 118 | ]); |
@@ -78,8 +78,7 @@ |
||
| 78 | 78 | $cust = Customer::findOrFail($id); |
| 79 | 79 | |
| 80 | 80 | return CustomerFile::where('cust_id', $id) |
| 81 | - ->when($cust->parent_id, function($q) use ($cust) |
|
| 82 | - { |
|
| 81 | + ->when($cust->parent_id, function($q) use ($cust) { |
|
| 83 | 82 | $q->orWhere('cust_id', $cust->parent_id)->where('shared', true); |
| 84 | 83 | }) |
| 85 | 84 | ->with('FileUpload') |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $cust = Customer::findOrFail($id); |
| 44 | 44 | |
| 45 | - try{ |
|
| 45 | + try { |
|
| 46 | 46 | $cust->update($request->only(['cust_id'])); |
| 47 | 47 | } |
| 48 | 48 | catch(QueryException $e) |
@@ -42,7 +42,8 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $cust = Customer::findOrFail($id); |
| 44 | 44 | |
| 45 | - try{ |
|
| 45 | + try |
|
| 46 | + { |
|
| 46 | 47 | $cust->update($request->only(['cust_id'])); |
| 47 | 48 | } |
| 48 | 49 | catch(QueryException $e) |