@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | public function up() |
16 | 16 | { |
17 | - Schema::create('tech_tip_types', function (Blueprint $table) { |
|
17 | + Schema::create('tech_tip_types', function(Blueprint $table) { |
|
18 | 18 | $table->bigIncrements('tip_type_id'); |
19 | 19 | $table->text('description'); |
20 | 20 | $table->timestamps(); |
@@ -81,7 +81,8 @@ discard block |
||
81 | 81 | // Added the ability to set an expiration date for user passwords - will force them to change after this expires |
82 | 82 | private function addPasswordExpiresColumn() |
83 | 83 | { |
84 | - if(!Schema::hasColumn('users', 'password_expires')) { |
|
84 | + if(!Schema::hasColumn('users', 'password_expires')) |
|
85 | + { |
|
85 | 86 | Schema::table('users', function(Blueprint $table) { |
86 | 87 | $table->timestamp('password_expires') |
87 | 88 | ->nullable() |
@@ -151,7 +152,8 @@ discard block |
||
151 | 152 | // Added a 'hidden' attribute to system customer data types to allow passwords to not be viewed unless clicked or focus |
152 | 153 | private function addHiddenColumn() |
153 | 154 | { |
154 | - if(!Schema::hasColumn('system_data_field_types', 'hidden')) { |
|
155 | + if(!Schema::hasColumn('system_data_field_types', 'hidden')) |
|
156 | + { |
|
155 | 157 | Schema::table('system_cust_data_types', function(Blueprint $table) { |
156 | 158 | $table->boolean('hidden') |
157 | 159 | ->default(0) |
@@ -163,7 +165,8 @@ discard block |
||
163 | 165 | // Update the File links table - add cust_id and note column |
164 | 166 | private function addColumnsToFileLinksTable() |
165 | 167 | { |
166 | - if(!Schema::hasColumn('file_links', 'cust_id')) { |
|
168 | + if(!Schema::hasColumn('file_links', 'cust_id')) |
|
169 | + { |
|
167 | 170 | Schema::table('file_links', function(Blueprint $table) { |
168 | 171 | $table->integer('cust_id') |
169 | 172 | ->unsigned() |
@@ -172,7 +175,8 @@ discard block |
||
172 | 175 | $table->foreign('cust_id')->references('cust_id')->on('customers')->onUpdate('cascade')->onDelete('cascade'); |
173 | 176 | }); |
174 | 177 | } |
175 | - if(!Schema::hasColumn('file_links', 'note')) { |
|
178 | + if(!Schema::hasColumn('file_links', 'note')) |
|
179 | + { |
|
176 | 180 | Schema::table('file_links', function(Blueprint $table) { |
177 | 181 | $table->longText('note') |
178 | 182 | ->nullable() |
@@ -180,7 +184,8 @@ discard block |
||
180 | 184 | }); |
181 | 185 | // Migrate the instructions from the old table to the new column |
182 | 186 | $instructions = DB::select('SELECT * FROM `file_link_instructions`'); |
183 | - foreach($instructions as $ins) { |
|
187 | + foreach($instructions as $ins) |
|
188 | + { |
|
184 | 189 | FileLinks::find($ins->link_id)->update([ |
185 | 190 | 'note' => $ins->instruction |
186 | 191 | ]); |
@@ -191,7 +196,8 @@ discard block |
||
191 | 196 | // Add Notes column to the file links files table |
192 | 197 | private function addNotesColumnToFileLinkFiles() |
193 | 198 | { |
194 | - if(!Schema::hasColumn('file_link_files', 'note')) { |
|
199 | + if(!Schema::hasColumn('file_link_files', 'note')) |
|
200 | + { |
|
195 | 201 | Schema::table('file_link_files', function(Blueprint $table) { |
196 | 202 | $table->longText('note') |
197 | 203 | ->nullable() |
@@ -199,7 +205,8 @@ discard block |
||
199 | 205 | }); |
200 | 206 | // Migrate the existing notes to the new table |
201 | 207 | $notes = DB::select('SELECT * FROM `file_link_notes`'); |
202 | - foreach($notes as $note) { |
|
208 | + foreach($notes as $note) |
|
209 | + { |
|
203 | 210 | FileLinkFiles::where('file_id', $note->file_id)->update([ |
204 | 211 | 'note' => $note->note |
205 | 212 | ]); |
@@ -210,7 +217,8 @@ discard block |
||
210 | 217 | // Add the documentation column to the tech tips table |
211 | 218 | private function migrateSystemDocumentation() |
212 | 219 | { |
213 | - if(!Schema::hasColumn('tech_tips', 'tip_type_id')) { |
|
220 | + if(!Schema::hasColumn('tech_tips', 'tip_type_id')) |
|
221 | + { |
|
214 | 222 | Schema::table('tech_tips', function(Blueprint $table) { |
215 | 223 | $table->bigInteger('tip_type_id')->unsigned()->after('public')->default(1); |
216 | 224 | $table->foreign('tip_type_id')->references('tip_type_id')->on('tech_tip_types')->onUpdate('cascade'); |
@@ -218,7 +226,8 @@ discard block |
||
218 | 226 | |
219 | 227 | // Move all of the system files over to the tech tips table |
220 | 228 | $sysFiles = DB::select('SELECT * FROM `system_files`'); |
221 | - foreach($sysFiles as $sysFile) { |
|
229 | + foreach($sysFiles as $sysFile) |
|
230 | + { |
|
222 | 231 | $newTip = TechTips::create([ |
223 | 232 | 'user_id' => $sysFile->user_id, |
224 | 233 | 'public' => 0, |
@@ -312,7 +321,8 @@ discard block |
||
312 | 321 | // Remove the system files and system file types table |
313 | 322 | private function removeSystemFilesTables() |
314 | 323 | { |
315 | - if(Schema::hasTable('system_files')) { |
|
324 | + if(Schema::hasTable('system_files')) |
|
325 | + { |
|
316 | 326 | Schema::table('system_files', function(Blueprint $table) { |
317 | 327 | $table->dropForeign(['sys_id']); |
318 | 328 | $table->dropForeign(['type_id']); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use App\TechTips; |
6 | 6 | use Faker\Generator as Faker; |
7 | 7 | |
8 | -$factory->define(TechTips::class, function (Faker $faker) { |
|
8 | +$factory->define(TechTips::class, function(Faker $faker) { |
|
9 | 9 | return [ |
10 | 10 | // |
11 | 11 | 'user_id' => factory(App\User::class)->create()->user_id, |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use App\TechTipTypes; |
6 | 6 | use Faker\Generator as Faker; |
7 | 7 | |
8 | -$factory->define(TechTipTypes::class, function (Faker $faker) { |
|
8 | +$factory->define(TechTipTypes::class, function(Faker $faker) { |
|
9 | 9 | return [ |
10 | 10 | // |
11 | 11 | 'description' => $faker->words(2), |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use App\Model; |
6 | 6 | use Faker\Generator as Faker; |
7 | 7 | |
8 | -$factory->define(Model::class, function (Faker $faker) { |
|
8 | +$factory->define(Model::class, function(Faker $faker) { |
|
9 | 9 | return [ |
10 | 10 | // |
11 | 11 | 'tip_id' => factory(App\TechTips::class)->create()->tip_id, |
@@ -8,58 +8,58 @@ discard block |
||
8 | 8 | /* |
9 | 9 | * Non user Routes |
10 | 10 | */ |
11 | -Route::get('/', 'Auth\LoginController@showLoginForm')->name('index'); |
|
12 | -Route::get('logout', 'Auth\LoginController@logout') ->name('logout'); |
|
11 | +Route::get('/', 'Auth\LoginController@showLoginForm')->name('index'); |
|
12 | +Route::get('logout', 'Auth\LoginController@logout') ->name('logout'); |
|
13 | 13 | Route::get('no-script', 'Controller@noScript') ->name('noscript'); |
14 | 14 | |
15 | 15 | |
16 | 16 | /* |
17 | 17 | * Download File Routes |
18 | 18 | */ |
19 | -Route::get('download/{id}/{filename}', 'DownloadController@index') ->name('download'); |
|
19 | +Route::get('download/{id}/{filename}', 'DownloadController@index') ->name('download'); |
|
20 | 20 | Route::get('download-archive/{filename}', 'DownloadController@downloadArchive')->name('downloadArchive'); |
21 | -Route::put('download-archive', 'DownloadController@archiveFiles') ->name('archiveFiles'); |
|
21 | +Route::put('download-archive', 'DownloadController@archiveFiles') ->name('archiveFiles'); |
|
22 | 22 | |
23 | 23 | |
24 | 24 | /* |
25 | 25 | * User Settings Routes |
26 | 26 | */ |
27 | -Route::get('account', 'AccountController@index') ->name('account'); |
|
28 | -Route::post('account', 'AccountController@submit') ->name('account'); |
|
29 | -Route::put('account', 'AccountController@notifications') ->name('account'); |
|
30 | -Route::get('/account/change-password', 'AccountController@changePassword')->name('changePassword'); |
|
27 | +Route::get('account', 'AccountController@index') ->name('account'); |
|
28 | +Route::post('account', 'AccountController@submit') ->name('account'); |
|
29 | +Route::put('account', 'AccountController@notifications') ->name('account'); |
|
30 | +Route::get('/account/change-password', 'AccountController@changePassword')->name('changePassword'); |
|
31 | 31 | Route::post('/account/change-password', 'AccountController@submitPassword')->name('changePassword'); |
32 | 32 | |
33 | 33 | /* |
34 | 34 | * Basic Logged In Routes |
35 | 35 | */ |
36 | -Route::get('about', 'DashboardController@about')->name('about'); |
|
36 | +Route::get('about', 'DashboardController@about')->name('about'); |
|
37 | 37 | Route::get('dashboard', 'DashboardController@index')->name('dashboard'); |
38 | 38 | |
39 | 39 | /* |
40 | 40 | * File Link Routes |
41 | 41 | */ |
42 | -Route::prefix('links')->name('links.')->group(function () { |
|
42 | +Route::prefix('links')->name('links.')->group(function() { |
|
43 | 43 | // Resource controllers for base access |
44 | - Route::resource('data', 'FileLinks\FileLinksController'); |
|
45 | - Route::get('new', 'FileLinks\FileLinksController@create') ->name('new'); |
|
46 | - Route::get('find/{id}', 'FileLinks\FileLinksController@find') ->name('user'); |
|
44 | + Route::resource('data', 'FileLinks\FileLinksController'); |
|
45 | + Route::get('new', 'FileLinks\FileLinksController@create') ->name('new'); |
|
46 | + Route::get('find/{id}', 'FileLinks\FileLinksController@find') ->name('user'); |
|
47 | 47 | Route::get('details/{id}/{name}', 'FileLinks\FileLinksController@details') ->name('details'); |
48 | - Route::get('disable/{id}', 'FileLinks\FileLinksController@disableLink')->name('disable'); |
|
48 | + Route::get('disable/{id}', 'FileLinks\FileLinksController@disableLink')->name('disable'); |
|
49 | 49 | // File Link Files |
50 | - Route::resource('files', 'FileLinks\LinkFilesController'); |
|
50 | + Route::resource('files', 'FileLinks\LinkFilesController'); |
|
51 | 51 | // Index landing page |
52 | - Route::get('/', 'FileLinks\FileLinksController@index') ->name('index'); |
|
52 | + Route::get('/', 'FileLinks\FileLinksController@index') ->name('index'); |
|
53 | 53 | }); |
54 | 54 | |
55 | 55 | /* |
56 | 56 | * Guest File Link Routes |
57 | 57 | */ |
58 | 58 | Route::get('file-links/{id}/get-files', 'FileLinks\GuestLinksController@getFiles')->name('file-links.getFiles'); |
59 | -Route::put('file-links/{id}', 'FileLinks\GuestLinksController@notify') ->name('file-links.show'); |
|
60 | -Route::post('file-links/{id}', 'FileLinks\GuestLinksController@update') ->name('file-links.show'); |
|
61 | -Route::get('file-links/{id}', 'FileLinks\GuestLinksController@show') ->name('file-links.show'); |
|
62 | -Route::get('file-links', 'FileLinks\GuestLinksController@index') ->name('file-links.index'); |
|
59 | +Route::put('file-links/{id}', 'FileLinks\GuestLinksController@notify') ->name('file-links.show'); |
|
60 | +Route::post('file-links/{id}', 'FileLinks\GuestLinksController@update') ->name('file-links.show'); |
|
61 | +Route::get('file-links/{id}', 'FileLinks\GuestLinksController@show') ->name('file-links.show'); |
|
62 | +Route::get('file-links', 'FileLinks\GuestLinksController@index') ->name('file-links.index'); |
|
63 | 63 | |
64 | 64 | /* |
65 | 65 | * Customer Routes |
@@ -67,23 +67,23 @@ discard block |
||
67 | 67 | Route::prefix('customer')->name('customer.')->group(function() |
68 | 68 | { |
69 | 69 | // Customer Files |
70 | - Route::resource('files', 'Customers\CustomerFilesController'); |
|
70 | + Route::resource('files', 'Customers\CustomerFilesController'); |
|
71 | 71 | // Custome Notes |
72 | - Route::get('download-note/{id}', 'DownloadController@downloadCustNote') ->name('download-note'); |
|
73 | - Route::resource('notes', 'Customers\CustomerNotesController'); |
|
72 | + Route::get('download-note/{id}', 'DownloadController@downloadCustNote') ->name('download-note'); |
|
73 | + Route::resource('notes', 'Customers\CustomerNotesController'); |
|
74 | 74 | // Customer Contacts |
75 | - Route::resource('contacts', 'Customers\CustomerContactsController'); |
|
75 | + Route::resource('contacts', 'Customers\CustomerContactsController'); |
|
76 | 76 | // Customer Systems |
77 | - Route::resource('systems', 'Customers\CustomerSystemsController'); |
|
77 | + Route::resource('systems', 'Customers\CustomerSystemsController'); |
|
78 | 78 | // Customer Details |
79 | - Route::get('id/{id}/{name}', 'Customers\CustomerDetailsController@details')->name('details'); |
|
80 | - Route::resource('id', 'Customers\CustomerDetailsController'); |
|
79 | + Route::get('id/{id}/{name}', 'Customers\CustomerDetailsController@details')->name('details'); |
|
80 | + Route::resource('id', 'Customers\CustomerDetailsController'); |
|
81 | 81 | // check Id and bookmark customer |
82 | 82 | Route::get('toggle-fav/{action}/{custID}', 'Customers\CustomerController@toggleFav') ->name('toggle-fav'); |
83 | - Route::get('check-id/{id}', 'Customers\CustomerController@checkID') ->name('check-id'); |
|
83 | + Route::get('check-id/{id}', 'Customers\CustomerController@checkID') ->name('check-id'); |
|
84 | 84 | // Index landing/search page |
85 | - Route::get('search', 'Customers\CustomerController@search') ->name('search'); |
|
86 | - Route::get('/', 'Customers\CustomerController@index') ->name('index'); |
|
85 | + Route::get('search', 'Customers\CustomerController@search') ->name('search'); |
|
86 | + Route::get('/', 'Customers\CustomerController@index') ->name('index'); |
|
87 | 87 | }); |
88 | 88 | |
89 | 89 |
@@ -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::get('search', 'TechTips\TechTipsController@search')->name('search'); |
97 | 95 | Route::get('details/{id}/{name}', 'TechTips\TechTipsController@details')->name('details'); |
98 | 96 | }); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | class TechTips extends Model |
8 | 8 | { |
9 | 9 | protected $primaryKey = 'tip_id'; |
10 | - protected $fillable = ['user_id', 'subject', 'tip_type_id', 'description', 'created_at']; // ToDo: Remove Created_at - future build |
|
10 | + protected $fillable = ['user_id', 'subject', 'tip_type_id', 'description', 'created_at']; // ToDo: Remove Created_at - future build |
|
11 | 11 | protected $casts = [ |
12 | 12 | 'created_at' => 'datetime:M d, Y', |
13 | 13 | 'updated_at' => 'datetime:M d, Y', |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | public function systemTypes() |
17 | 17 | { |
18 | - return $this->hasManyThrough('App\SystemTypes', 'App\TechTipSystems', 'tip_id', 'sys_id', 'tip_id', 'sys_id'); |
|
18 | + return $this->hasManyThrough('App\SystemTypes', 'App\TechTipSystems', 'tip_id', 'sys_id', 'tip_id', 'sys_id'); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | // public function user() |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | else |
271 | 271 | { |
272 | 272 | $article = isset($request->search['articleType']) ? true : false; |
273 | - $system = isset($request->search['systemType']) ? true : false; |
|
273 | + $system = isset($request->search['systemType']) ? true : false; |
|
274 | 274 | // Search paramaters, filter results |
275 | 275 | $tips = new TechTipsCollection( |
276 | 276 | TechTips::orderBy('created_at', 'DESC') |
@@ -278,14 +278,14 @@ discard block |
||
278 | 278 | ->where(function($query) use ($request) |
279 | 279 | { |
280 | 280 | $query->where('subject', 'like', '%'.$request->search['searchText'].'%') |
281 | - ->orWhere('tip_id', 'like', '%' . $request->search['searchText'].'%') |
|
282 | - ->orWhere('description', 'like', '%' . $request->search['searchText'].'%'); |
|
281 | + ->orWhere('tip_id', 'like', '%'.$request->search['searchText'].'%') |
|
282 | + ->orWhere('description', 'like', '%'.$request->search['searchText'].'%'); |
|
283 | 283 | }) |
284 | 284 | ->when($article, function($query) use ($request) |
285 | 285 | { |
286 | 286 | $query->whereIn('tip_type_id', $request->search['articleType']); |
287 | 287 | }) |
288 | - ->when($system, function ($query) use ($request) { |
|
288 | + ->when($system, function($query) use ($request) { |
|
289 | 289 | $query->whereHas('SystemTypes', function($query) use ($request) |
290 | 290 | { |
291 | 291 | $query->whereIn('system_types.sys_id', $request->search['systemType']); |
@@ -275,19 +275,16 @@ |
||
275 | 275 | $tips = new TechTipsCollection( |
276 | 276 | TechTips::orderBy('created_at', 'DESC') |
277 | 277 | // Search by id or a phrase in the title or description |
278 | - ->where(function($query) use ($request) |
|
279 | - { |
|
278 | + ->where(function($query) use ($request) { |
|
280 | 279 | $query->where('subject', 'like', '%'.$request->search['searchText'].'%') |
281 | 280 | ->orWhere('tip_id', 'like', '%' . $request->search['searchText'].'%') |
282 | 281 | ->orWhere('description', 'like', '%' . $request->search['searchText'].'%'); |
283 | 282 | }) |
284 | - ->when($article, function($query) use ($request) |
|
285 | - { |
|
283 | + ->when($article, function($query) use ($request) { |
|
286 | 284 | $query->whereIn('tip_type_id', $request->search['articleType']); |
287 | 285 | }) |
288 | 286 | ->when($system, function ($query) use ($request) { |
289 | - $query->whereHas('SystemTypes', function($query) use ($request) |
|
290 | - { |
|
287 | + $query->whereHas('SystemTypes', function($query) use ($request) { |
|
291 | 288 | $query->whereIn('system_types.sys_id', $request->search['systemType']); |
292 | 289 | }); |
293 | 290 | }) |