@@ -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) |
@@ -33,8 +33,7 @@ |
||
33 | 33 | { |
34 | 34 | // |
35 | 35 | $notificationType = UserSettingType::where('name', 'Receive Email Notifications')->first(); |
36 | - $userList = User::whereHas('UserSetting', function($q) use ($notificationType) |
|
37 | - { |
|
36 | + $userList = User::whereHas('UserSetting', function($q) use ($notificationType) { |
|
38 | 37 | $q->where('setting_type_id', $notificationType->setting_type_id)->where('value', true); |
39 | 38 | })->get(); |
40 | 39 |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | public function __invoke(SearchTipsRequest $request) |
15 | 15 | { |
16 | 16 | $dirty = false; |
17 | - $searchText = isset($request->search_text) ? explode(' ', $request->search_text) : null; |
|
18 | - $searchEquip = isset($request->search_equip_id) ? $request->search_equip_id : null; |
|
19 | - $searchType = isset($request->search_type) ? $request->search_type : null; |
|
17 | + $searchText = isset($request->search_text) ? explode(' ', $request->search_text) : null; |
|
18 | + $searchEquip = isset($request->search_equip_id) ? $request->search_equip_id : null; |
|
19 | + $searchType = isset($request->search_type) ? $request->search_type : null; |
|
20 | 20 | |
21 | 21 | // Determine if any search queries have been entered |
22 | 22 | if($searchText || $searchEquip || $searchType) |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | ->orderBy('sticky', 'DESC') |
36 | 36 | ->orderBy('created_at', 'DESC') |
37 | 37 | // Search text fields |
38 | - ->when($searchText, function ($q) use($searchText) |
|
38 | + ->when($searchText, function($q) use($searchText) |
|
39 | 39 | { |
40 | 40 | foreach($searchText as $text) |
41 | 41 | { |
@@ -35,8 +35,7 @@ discard block |
||
35 | 35 | ->orderBy('sticky', 'DESC') |
36 | 36 | ->orderBy('created_at', 'DESC') |
37 | 37 | // Search text fields |
38 | - ->when($searchText, function ($q) use($searchText) |
|
39 | - { |
|
38 | + ->when($searchText, function ($q) use($searchText) { |
|
40 | 39 | foreach($searchText as $text) |
41 | 40 | { |
42 | 41 | $q->orWhere('subject', 'like', '%'.$text.'%') |
@@ -45,15 +44,12 @@ discard block |
||
45 | 44 | } |
46 | 45 | }) |
47 | 46 | // Search Article Type field |
48 | - ->when($searchType, function($q) use($searchType) |
|
49 | - { |
|
47 | + ->when($searchType, function($q) use($searchType) { |
|
50 | 48 | $q->whereIn('tip_type_id', $searchType); |
51 | 49 | }) |
52 | 50 | // Search Equipment Type field |
53 | - ->when($searchEquip, function($q) use($searchEquip) |
|
54 | - { |
|
55 | - $q->whereHas('EquipmentType', function($q2) use ($searchEquip) |
|
56 | - { |
|
51 | + ->when($searchEquip, function($q) use($searchEquip) { |
|
52 | + $q->whereHas('EquipmentType', function($q2) use ($searchEquip) { |
|
57 | 53 | $q2->whereIn('equipment_types.equip_id', $searchEquip); |
58 | 54 | }); |
59 | 55 | }) |