@@ -64,8 +64,7 @@ discard block |
||
64 | 64 | /* |
65 | 65 | * Customer Routes |
66 | 66 | */ |
67 | -Route::prefix('customer')->name('customer.')->group(function() |
|
68 | -{ |
|
67 | +Route::prefix('customer')->name('customer.')->group(function() { |
|
69 | 68 | // Customer Files |
70 | 69 | Route::resource('files', 'Customers\CustomerFilesController'); |
71 | 70 | // Custome Notes |
@@ -91,8 +90,7 @@ discard block |
||
91 | 90 | * Tech Tip Routes |
92 | 91 | */ |
93 | 92 | Route::resource('tips', 'TechTips\TechTipsController'); |
94 | -Route::prefix('tip')->name('tip.')->group(function() |
|
95 | -{ |
|
93 | +Route::prefix('tip')->name('tip.')->group(function() { |
|
96 | 94 | Route::resource('comments', 'TechTips\TechTipCommentsController'); |
97 | 95 | Route::get('search', 'TechTips\TechTipsController@search') ->name('search'); |
98 | 96 | Route::get('details/{id}/{name}', 'TechTips\TechTipsController@details') ->name('details'); |
@@ -82,7 +82,8 @@ discard block |
||
82 | 82 | // Added the ability to set an expiration date for user passwords - will force them to change after this expires |
83 | 83 | private function addPasswordExpiresColumn() |
84 | 84 | { |
85 | - if(!Schema::hasColumn('users', 'password_expires')) { |
|
85 | + if(!Schema::hasColumn('users', 'password_expires')) |
|
86 | + { |
|
86 | 87 | Schema::table('users', function(Blueprint $table) { |
87 | 88 | $table->timestamp('password_expires') |
88 | 89 | ->nullable() |
@@ -153,7 +154,8 @@ discard block |
||
153 | 154 | // Added a 'hidden' attribute to system customer data types to allow passwords to not be viewed unless clicked or focus |
154 | 155 | private function addHiddenColumn() |
155 | 156 | { |
156 | - if(!Schema::hasColumn('system_data_field_types', 'hidden')) { |
|
157 | + if(!Schema::hasColumn('system_data_field_types', 'hidden')) |
|
158 | + { |
|
157 | 159 | Schema::table('system_cust_data_types', function(Blueprint $table) { |
158 | 160 | $table->boolean('hidden') |
159 | 161 | ->default(0) |
@@ -165,7 +167,8 @@ discard block |
||
165 | 167 | // Update the File links table - add cust_id and note column |
166 | 168 | private function addColumnsToFileLinksTable() |
167 | 169 | { |
168 | - if(!Schema::hasColumn('file_links', 'cust_id')) { |
|
170 | + if(!Schema::hasColumn('file_links', 'cust_id')) |
|
171 | + { |
|
169 | 172 | Schema::table('file_links', function(Blueprint $table) { |
170 | 173 | $table->integer('cust_id') |
171 | 174 | ->unsigned() |
@@ -174,7 +177,8 @@ discard block |
||
174 | 177 | $table->foreign('cust_id')->references('cust_id')->on('customers')->onUpdate('cascade')->onDelete('cascade'); |
175 | 178 | }); |
176 | 179 | } |
177 | - if(!Schema::hasColumn('file_links', 'note')) { |
|
180 | + if(!Schema::hasColumn('file_links', 'note')) |
|
181 | + { |
|
178 | 182 | Schema::table('file_links', function(Blueprint $table) { |
179 | 183 | $table->longText('note') |
180 | 184 | ->nullable() |
@@ -182,7 +186,8 @@ discard block |
||
182 | 186 | }); |
183 | 187 | // Migrate the instructions from the old table to the new column |
184 | 188 | $instructions = DB::select('SELECT * FROM `file_link_instructions`'); |
185 | - foreach($instructions as $ins) { |
|
189 | + foreach($instructions as $ins) |
|
190 | + { |
|
186 | 191 | FileLinks::find($ins->link_id)->update([ |
187 | 192 | 'note' => $ins->instruction |
188 | 193 | ]); |
@@ -193,7 +198,8 @@ discard block |
||
193 | 198 | // Add Notes column to the file links files table |
194 | 199 | private function addNotesColumnToFileLinkFiles() |
195 | 200 | { |
196 | - if(!Schema::hasColumn('file_link_files', 'note')) { |
|
201 | + if(!Schema::hasColumn('file_link_files', 'note')) |
|
202 | + { |
|
197 | 203 | Schema::table('file_link_files', function(Blueprint $table) { |
198 | 204 | $table->longText('note') |
199 | 205 | ->nullable() |
@@ -201,7 +207,8 @@ discard block |
||
201 | 207 | }); |
202 | 208 | // Migrate the existing notes to the new table |
203 | 209 | $notes = DB::select('SELECT * FROM `file_link_notes`'); |
204 | - foreach($notes as $note) { |
|
210 | + foreach($notes as $note) |
|
211 | + { |
|
205 | 212 | FileLinkFiles::where('file_id', $note->file_id)->update([ |
206 | 213 | 'note' => $note->note |
207 | 214 | ]); |
@@ -212,7 +219,8 @@ discard block |
||
212 | 219 | // Add the documentation column to the tech tips table |
213 | 220 | private function migrateSystemDocumentation() |
214 | 221 | { |
215 | - if(!Schema::hasColumn('tech_tips', 'tip_type_id')) { |
|
222 | + if(!Schema::hasColumn('tech_tips', 'tip_type_id')) |
|
223 | + { |
|
216 | 224 | Schema::table('tech_tips', function(Blueprint $table) { |
217 | 225 | $table->bigInteger('tip_type_id')->unsigned()->after('public')->default(1); |
218 | 226 | $table->foreign('tip_type_id')->references('tip_type_id')->on('tech_tip_types')->onUpdate('cascade'); |
@@ -220,7 +228,8 @@ discard block |
||
220 | 228 | |
221 | 229 | // Move all of the system files over to the tech tips table |
222 | 230 | $sysFiles = DB::select('SELECT * FROM `system_files`'); |
223 | - foreach($sysFiles as $sysFile) { |
|
231 | + foreach($sysFiles as $sysFile) |
|
232 | + { |
|
224 | 233 | $newTip = TechTips::create([ |
225 | 234 | 'user_id' => $sysFile->user_id, |
226 | 235 | 'public' => 0, |
@@ -314,7 +323,8 @@ discard block |
||
314 | 323 | // Remove the system files and system file types table |
315 | 324 | private function removeSystemFilesTables() |
316 | 325 | { |
317 | - if(Schema::hasTable('system_files')) { |
|
326 | + if(Schema::hasTable('system_files')) |
|
327 | + { |
|
318 | 328 | Schema::table('system_files', function(Blueprint $table) { |
319 | 329 | $table->dropForeign(['sys_id']); |
320 | 330 | $table->dropForeign(['type_id']); |
@@ -360,7 +370,8 @@ discard block |
||
360 | 370 | // Add soft deletes to tech tips table to prevent accidental deletes |
361 | 371 | private function addSoftDeleteToTechTips() |
362 | 372 | { |
363 | - if (!Schema::hasColumn('tech_tips', 'deleted_at')) { |
|
373 | + if (!Schema::hasColumn('tech_tips', 'deleted_at')) |
|
374 | + { |
|
364 | 375 | Schema::table('tech_tips', function (Blueprint $table) { |
365 | 376 | $table->softDeletes()->after('description'); |
366 | 377 | }); |
@@ -62,14 +62,17 @@ discard block |
||
62 | 62 | Log::debug('request Data -> ', $request->toArray()); |
63 | 63 | |
64 | 64 | // See if there are any search paramaters entered |
65 | - if (!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType'])) { |
|
65 | + if (!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType'])) |
|
66 | + { |
|
66 | 67 | // No search paramaters, send all tech tips |
67 | 68 | $tips = new TechTipsCollection( |
68 | 69 | TechTips::orderBy('created_at', 'DESC') |
69 | 70 | ->with('SystemTypes') |
70 | 71 | ->paginate($request->pagination['perPage']) |
71 | 72 | ); |
72 | - } else { |
|
73 | + } |
|
74 | + else |
|
75 | + { |
|
73 | 76 | $article = isset($request->search['articleType']) ? true : false; |
74 | 77 | $system = isset($request->search['systemType']) ? true : false; |
75 | 78 | // Search paramaters, filter results |
@@ -157,7 +160,8 @@ discard block |
||
157 | 160 | $save = $receiver->receive(); |
158 | 161 | |
159 | 162 | // See if the uploade has finished |
160 | - if ($save->isFinished()) { |
|
163 | + if ($save->isFinished()) |
|
164 | + { |
|
161 | 165 | $this->saveFile($save->getFile()); |
162 | 166 | |
163 | 167 | return 'uploaded successfully'; |
@@ -251,8 +255,7 @@ discard block |
||
251 | 255 | if(!$tipData->supressEmail) |
252 | 256 | { |
253 | 257 | $details = TechTips::find($tipID); |
254 | - $users = User::where('active', 1)->whereHas('UserSettings', function($query) |
|
255 | - { |
|
258 | + $users = User::where('active', 1)->whereHas('UserSettings', function($query) { |
|
256 | 259 | $query->where('em_tech_tip', 1); |
257 | 260 | })->get(); |
258 | 261 | |
@@ -266,7 +269,8 @@ discard block |
||
266 | 269 | // Details controller - will move to the show controller with just the tech tip id |
267 | 270 | public function details($id, $subject) |
268 | 271 | { |
269 | - if (session()->has('newTipFile')) { |
|
272 | + if (session()->has('newTipFile')) |
|
273 | + { |
|
270 | 274 | session()->forget('newTipFile'); |
271 | 275 | } |
272 | 276 | |
@@ -300,7 +304,8 @@ discard block |
||
300 | 304 | public function toggleFav($action, $id) |
301 | 305 | { |
302 | 306 | // |
303 | - switch ($action) { |
|
307 | + switch ($action) |
|
308 | + { |
|
304 | 309 | case 'add': |
305 | 310 | TechTipFavs::create([ |
306 | 311 | 'user_id' => Auth::user()->user_id, |