@@ -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']); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | public function getUserCustomerFavs() |
| 25 | 25 | { |
| 26 | 26 | $custFavs = CustomerFavs::where('user_id', $this->userID) |
| 27 | - ->with(array('Customers' => function($query){ |
|
| 27 | + ->with(array('Customers' => function($query) { |
|
| 28 | 28 | $query->select('cust_id', 'name'); |
| 29 | 29 | })) |
| 30 | 30 | ->get(); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | public function getUserTechTipFavs() |
| 36 | 36 | { |
| 37 | 37 | $tipFavs = TechTipFavs::where('user_id', $this->userID) |
| 38 | - ->with(array('TechTips' => function($query){ |
|
| 38 | + ->with(array('TechTips' => function($query) { |
|
| 39 | 39 | $query->select('tip_id', 'subject'); |
| 40 | 40 | })) |
| 41 | 41 | ->get(); |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function getUserCustomerFavs() |
| 24 | 24 | { |
| 25 | - $custFavs = CustomerFavs::where('user_id', $this->userID) |
|
| 26 | - ->with(array('Customers' => function($query){ |
|
| 25 | + $custFavs = CustomerFavs::where('user_id', $this->userID) |
|
| 26 | + ->with(array('Customers' => function($query) { |
|
| 27 | 27 | $query->select('cust_id', 'name'); |
| 28 | 28 | })) |
| 29 | 29 | ->get(); |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function getUserTechTipFavs() |
| 43 | 43 | { |
| 44 | - $tipFavs = TechTipFavs::where('user_id', $this->userID) |
|
| 45 | - ->with(array('TechTips' => function($query){ |
|
| 44 | + $tipFavs = TechTipFavs::where('user_id', $this->userID) |
|
| 45 | + ->with(array('TechTips' => function($query) { |
|
| 46 | 46 | $query->select('tip_id', 'subject'); |
| 47 | 47 | })) |
| 48 | 48 | ->get(); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | public function getUserTotalLinks() |
| 70 | 70 | { |
| 71 | - $totalLinks = FileLinks::where('user_id', $this->userID)->count(); |
|
| 71 | + $totalLinks = FileLinks::where('user_id', $this->userID)->count(); |
|
| 72 | 72 | |
| 73 | 73 | Log::debug('Retrieved count of total File Links for User ID'.$this->userID.'. Data - './** @scrutinizer ignore-type */$totalLinks.' found'); |
| 74 | 74 | return $totalLinks; |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | public function find($id) |
| 43 | 43 | { |
| 44 | 44 | // If the user is trying to access the links of another user, they must have the proper permissions permissions |
| 45 | - if ($id != 0) |
|
| 45 | + if($id != 0) |
|
| 46 | 46 | { |
| 47 | 47 | $this->authorize('hasAccess', 'manage_users'); |
| 48 | 48 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | ->orderBy('expire', 'desc')->get(); |
| 27 | 27 | |
| 28 | 28 | Log::debug('Retrieved all File Links for User ID '.$this->id.'. Data Gathered - ', array($links)); |
| 29 | - if ($this->collection) { |
|
| 29 | + if($this->collection) { |
|
| 30 | 30 | return new FileLinksCollection($links); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -26,7 +26,8 @@ |
||
| 26 | 26 | ->orderBy('expire', 'desc')->get(); |
| 27 | 27 | |
| 28 | 28 | Log::debug('Retrieved all File Links for User ID '.$this->id.'. Data Gathered - ', array($links)); |
| 29 | - if ($this->collection) { |
|
| 29 | + if ($this->collection) |
|
| 30 | + { |
|
| 30 | 31 | return new FileLinksCollection($links); |
| 31 | 32 | } |
| 32 | 33 | |
@@ -12,14 +12,14 @@ |
||
| 12 | 12 | { |
| 13 | 13 | public function getTipsInLastDays($numDays = 30) |
| 14 | 14 | { |
| 15 | - $tips = TechTips::where('created_at', '>', Carbon::now()->subDays($numDays))->count(); |
|
| 15 | + $tips = TechTips::where('created_at', '>', Carbon::now()->subDays($numDays))->count(); |
|
| 16 | 16 | Log::debug('Retrieved new Tech Tip count for last '.$numDays.' days. Count - $tips'); |
| 17 | 17 | return $tips; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function getTotalTechTipCount() |
| 21 | 21 | { |
| 22 | - $tipsTotal = TechTips::all()->count(); |
|
| 22 | + $tipsTotal = TechTips::all()->count(); |
|
| 23 | 23 | Log::debug('Retrieved total Tech Tip count. Count - $tips'); |
| 24 | 24 | return $tipsTotal; |
| 25 | 25 | } |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | protected function isFileDup($fileName) |
| 75 | 75 | { |
| 76 | 76 | // Determine if the filename already exists |
| 77 | - if (Storage::exists($this->path . DIRECTORY_SEPARATOR . $fileName)) |
|
| 77 | + if(Storage::exists($this->path.DIRECTORY_SEPARATOR.$fileName)) |
|
| 78 | 78 | { |
| 79 | 79 | $fileParts = pathinfo($fileName); |
| 80 | - $extension = isset($fileParts['extension']) ? ('.' . $fileParts['extension']) : ''; |
|
| 80 | + $extension = isset($fileParts['extension']) ? ('.'.$fileParts['extension']) : ''; |
|
| 81 | 81 | |
| 82 | 82 | // Look to see if a number is already appended to a file. (example - file(1).pdf) |
| 83 | - if (preg_match('/(.*?)(\d+)$/', $fileParts['filename'], $match)) |
|
| 83 | + if(preg_match('/(.*?)(\d+)$/', $fileParts['filename'], $match)) |
|
| 84 | 84 | { |
| 85 | 85 | // Has a number, increment it |
| 86 | 86 | $base = $match[1]; |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | // Increase the number until one that is not in use is found |
| 97 | 97 | do |
| 98 | 98 | { |
| 99 | - $fileName = $base . '(' . ++$number . ')' . $extension; |
|
| 100 | - } while (Storage::exists($this->path.DIRECTORY_SEPARATOR.$fileName)); |
|
| 99 | + $fileName = $base.'('.++$number.')'.$extension; |
|
| 100 | + } while(Storage::exists($this->path.DIRECTORY_SEPARATOR.$fileName)); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | return $fileName; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | $data = Files::find($fileID); |
| 110 | 110 | // Move the file to the proper folder |
| 111 | - try{ |
|
| 111 | + try { |
|
| 112 | 112 | Log::debug('Attempting to moving file '.$fileID.' to '.$newPath); |
| 113 | 113 | Storage::move($data->file_link.$data->file_name, $newPath.DIRECTORY_SEPARATOR.$data->file_name); |
| 114 | 114 | } |
@@ -108,7 +108,8 @@ |
||
| 108 | 108 | { |
| 109 | 109 | $data = Files::find($fileID); |
| 110 | 110 | // Move the file to the proper folder |
| 111 | - try{ |
|
| 111 | + try |
|
| 112 | + { |
|
| 112 | 113 | Log::debug('Attempting to moving file '.$fileID.' to '.$newPath); |
| 113 | 114 | Storage::move($data->file_link.$data->file_name, $newPath.DIRECTORY_SEPARATOR.$data->file_name); |
| 114 | 115 | } |
@@ -81,8 +81,7 @@ |
||
| 81 | 81 | |
| 82 | 82 | // Determine if there is a new password expire's date |
| 83 | 83 | $newExpire = config('auth.passwords.settings.expire') != null ? |
| 84 | - Carbon::now()->addDays(config('auth.passwords.settings.expire')) : |
|
| 85 | - null; |
|
| 84 | + Carbon::now()->addDays(config('auth.passwords.settings.expire')) : null; |
|
| 86 | 85 | |
| 87 | 86 | User::find($userID)->update([ |
| 88 | 87 | 'password' => bcrypt($request->newPass), |
@@ -47,8 +47,7 @@ discard block |
||
| 47 | 47 | $searchResults = new CustomersCollection( |
| 48 | 48 | Customers::orderBy($request->sortField, $request->sortType) |
| 49 | 49 | // Search the name, dba name, and cust id columns |
| 50 | - ->where(function($query) use ($request) |
|
| 51 | - { |
|
| 50 | + ->where(function($query) use ($request) { |
|
| 52 | 51 | $query->where('name', 'like', '%'.$request->name.'%') |
| 53 | 52 | ->orWhere('cust_id', 'like', '%'.$request->name.'%') |
| 54 | 53 | ->orWhere('dba_name', 'like', '%'.$request->name.'%'); |
@@ -58,10 +57,8 @@ discard block |
||
| 58 | 57 | // Include the customers systems |
| 59 | 58 | ->with('CustomerSystems.SystemTypes') |
| 60 | 59 | // If the system field is present - search for system type |
| 61 | - ->when($request->system, function($query) use ($request) |
|
| 62 | - { |
|
| 63 | - $query->whereHas('CustomerSystems.SystemTypes', function($query) use ($request) |
|
| 64 | - { |
|
| 60 | + ->when($request->system, function($query) use ($request) { |
|
| 61 | + $query->whereHas('CustomerSystems.SystemTypes', function($query) use ($request) { |
|
| 65 | 62 | $query->where('sys_id', $request->system); |
| 66 | 63 | }); |
| 67 | 64 | }) |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | { |
| 38 | 38 | $contact = CustomerContacts::where('cont_id', $contID)->with('CustomerContactPhones')->first(); |
| 39 | 39 | $contactName = explode(' ', $contact->name); |
| 40 | - $contactDetails = collect( (object) [ |
|
| 40 | + $contactDetails = collect((object) [ |
|
| 41 | 41 | 'firstName' => $contactName[0], |
| 42 | 42 | 'lastName' => isset($contactName[1]) ? $contactName[1] : '', |
| 43 | 43 | 'email' => $contact->eamil, |