@@ -190,10 +190,10 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
| 193 | - * Check if the user has the specified role. |
|
| 194 | - * @param string $role This may be either 'applicant', 'manager', 'hr_advisor' or 'admin'. |
|
| 195 | - * @return boolean |
|
| 196 | - */ |
|
| 193 | + * Check if the user has the specified role. |
|
| 194 | + * @param string $role This may be either 'applicant', 'manager', 'hr_advisor' or 'admin'. |
|
| 195 | + * @return boolean |
|
| 196 | + */ |
|
| 197 | 197 | public function hasRole($role) |
| 198 | 198 | { |
| 199 | 199 | switch ($role) { |
@@ -214,8 +214,8 @@ discard block |
||
| 214 | 214 | * Set this user to the specified role. |
| 215 | 215 | * |
| 216 | 216 | * @param string $role Must be either 'applicant', 'manager', 'hr_advisor' or 'admin'. |
| 217 | - * @return void |
|
| 218 | - */ |
|
| 217 | + * @return void |
|
| 218 | + */ |
|
| 219 | 219 | public function setRole(string $role): void |
| 220 | 220 | { |
| 221 | 221 | $this->user_role()->associate(UserRole::where('name', $role)->firstOrFail()); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * Returns a user's full name. |
| 251 | 251 | * |
| 252 | 252 | * @return string |
| 253 | - */ |
|
| 253 | + */ |
|
| 254 | 254 | public function getFullNameAttribute(): string |
| 255 | 255 | { |
| 256 | 256 | return $this->first_name . ' ' . $this->last_name; |
@@ -238,12 +238,12 @@ |
||
| 238 | 238 | 'logout_link' => route('hr_advisor.logout'), |
| 239 | 239 | ]; |
| 240 | 240 | } elseif (WhichPortal::isAdminPortal()) { |
| 241 | - $loginModals = [ |
|
| 241 | + $loginModals = [ |
|
| 242 | 242 | 'modals' => Lang::get('common/login_modals'), |
| 243 | 243 | 'register_link' => route('register'), |
| 244 | 244 | 'login_link' => backpack_url('login'), |
| 245 | 245 | 'logout_link' => backpack_url('logout'), |
| 246 | - ]; |
|
| 246 | + ]; |
|
| 247 | 247 | } else { |
| 248 | 248 | $loginModals = [ |
| 249 | 249 | 'modals' => Lang::get('common/login_modals'), |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | public function getNameAttribute(): string |
| 77 | 77 | { |
| 78 | 78 | if ($this->user !== null) { |
| 79 | - return $this->user->first_name . ' ' . $this->user->last_name; |
|
| 79 | + return $this->user->first_name.' '.$this->user->last_name; |
|
| 80 | 80 | } |
| 81 | 81 | return ''; |
| 82 | 82 | } |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | 'prefix' => LaravelLocalization::setLocale(), |
| 19 | 19 | 'middleware' => ['localeSessionRedirect', 'localizationRedirect', 'localeViewPath'] |
| 20 | 20 | ], |
| 21 | - function () : void { |
|
| 21 | + function() : void { |
|
| 22 | 22 | /** ADD ALL LOCALIZED ROUTES INSIDE THIS GROUP **/ |
| 23 | 23 | |
| 24 | - Route::group(['prefix' => 'demo'], function () : void { |
|
| 24 | + Route::group(['prefix' => 'demo'], function() : void { |
|
| 25 | 25 | |
| 26 | 26 | /* Temporary Blog Index */ |
| 27 | 27 | Route::view('blog', 'common/blog-index')->middleware('localOnly')->name('blog'); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | 53 | |
| 54 | - Route::group(['prefix' => config('app.applicant_prefix')], function () : void { |
|
| 54 | + Route::group(['prefix' => config('app.applicant_prefix')], function() : void { |
|
| 55 | 55 | |
| 56 | 56 | /* Home */ |
| 57 | 57 | Route::get('/', 'HomepageController@applicant')->name('home'); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | ->name('jobs.show'); |
| 65 | 65 | |
| 66 | 66 | /* Require being logged in */ |
| 67 | - Route::middleware(['auth'])->group(function () : void { |
|
| 67 | + Route::middleware(['auth'])->group(function() : void { |
|
| 68 | 68 | /* Managers */ |
| 69 | 69 | Route::get('managers/{manager}', 'ManagerProfileController@show') |
| 70 | 70 | ->middleware('can:view,manager') |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | }); |
| 73 | 73 | |
| 74 | 74 | /* Require being logged in as applicant */ |
| 75 | - Route::middleware(['auth', 'role:applicant'])->group(function () : void { |
|
| 75 | + Route::middleware(['auth', 'role:applicant'])->group(function() : void { |
|
| 76 | 76 | |
| 77 | 77 | // Application permissions are handled within the controller instead of with middleware |
| 78 | 78 | /* Applications */ |
@@ -207,9 +207,9 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | Route::group([ |
| 209 | 209 | 'prefix' => config('app.manager_prefix'), |
| 210 | - ], function (): void { |
|
| 210 | + ], function(): void { |
|
| 211 | 211 | |
| 212 | - Route::middleware(['finishManagerRegistration'])->group(function (): void { |
|
| 212 | + Route::middleware(['finishManagerRegistration'])->group(function(): void { |
|
| 213 | 213 | |
| 214 | 214 | /* Home */ |
| 215 | 215 | Route::get('/', 'HomepageController@manager')->name('manager.home'); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | 'ManagerProfileController@faq' |
| 226 | 226 | )->name('manager.faq.section'); |
| 227 | 227 | |
| 228 | - Route::middleware(['auth', 'role:manager'])->group(function (): void { |
|
| 228 | + Route::middleware(['auth', 'role:manager'])->group(function(): void { |
|
| 229 | 229 | |
| 230 | 230 | Route::get('profile', 'ManagerProfileController@editAuthenticated')->name('manager.profile'); |
| 231 | 231 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | }); |
| 323 | 323 | |
| 324 | 324 | // These routes must be excluded from the finishManagerRegistration middleware to avoid an infinite loop of redirects |
| 325 | - Route::middleware(['auth', 'role:manager'])->group(function (): void { |
|
| 325 | + Route::middleware(['auth', 'role:manager'])->group(function(): void { |
|
| 326 | 326 | Route::get('first-visit', 'Auth\FirstVisitController@showFirstVisitManagerForm') |
| 327 | 327 | ->name('manager.first_visit'); |
| 328 | 328 | Route::post('finish_registration', 'Auth\FirstVisitController@finishManagerRegistration') |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | /* AJAX calls =============================================================== */ |
| 349 | 349 | |
| 350 | 350 | /* Require being logged in */ |
| 351 | - Route::middleware(['auth'])->group(function () : void { |
|
| 351 | + Route::middleware(['auth'])->group(function() : void { |
|
| 352 | 352 | |
| 353 | 353 | Route::delete('courses/{course}', 'CourseController@destroy') |
| 354 | 354 | ->middleware('can:delete,course') |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | 'prefix' => 'admin', |
| 414 | 414 | 'middleware' => ['auth', 'role:admin'] |
| 415 | 415 | ], |
| 416 | - function (): void { |
|
| 416 | + function(): void { |
|
| 417 | 417 | /* Edit Job */ |
| 418 | 418 | Route::get('jobs/{jobPoster}/edit', 'JobController@edit') |
| 419 | 419 | ->where('jobPoster', '[0-9]+') |
@@ -430,15 +430,15 @@ discard block |
||
| 430 | 430 | |
| 431 | 431 | Route::group([ |
| 432 | 432 | 'prefix' => config('app.hr_prefix'), |
| 433 | - ], function (): void { |
|
| 433 | + ], function(): void { |
|
| 434 | 434 | |
| 435 | - Route::middleware(['finishHrRegistration'])->group(function (): void { |
|
| 435 | + Route::middleware(['finishHrRegistration'])->group(function(): void { |
|
| 436 | 436 | |
| 437 | 437 | Route::get('/', 'HomepageController@hr_advisor')->name('hr_advisor.home'); |
| 438 | 438 | }); |
| 439 | 439 | |
| 440 | 440 | // These routes must be excluded from the finishHrAdvisorRegistration middleware to avoid an infinite loop of redirects |
| 441 | - Route::middleware(['auth', 'role:hr_advisor'])->group(function (): void { |
|
| 441 | + Route::middleware(['auth', 'role:hr_advisor'])->group(function(): void { |
|
| 442 | 442 | Route::get('first-visit', 'Auth\FirstVisitController@showFirstVisitHrForm') |
| 443 | 443 | ->name('hr_advisor.first_visit'); |
| 444 | 444 | Route::post('finish_registration', 'Auth\FirstVisitController@finishHrRegistration') |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | 'prefix' => 'admin', |
| 470 | 470 | 'middleware' => ['auth', 'role:admin'] |
| 471 | 471 | ], |
| 472 | - function (): void { |
|
| 472 | + function(): void { |
|
| 473 | 473 | // This page is non-localized, because the middleware that redirects to localized pages changes POSTs to GETs and messes up the request. |
| 474 | 474 | Route::post('jobs/create/as-manager/{manager}', 'JobController@createAsManager') |
| 475 | 475 | ->middleware('can:create,App\Models\JobPoster') |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | |
| 484 | 484 | |
| 485 | 485 | /** API routes - currently using same default http auth, but not localized */ |
| 486 | -Route::group(['prefix' => 'api'], function (): void { |
|
| 486 | +Route::group(['prefix' => 'api'], function(): void { |
|
| 487 | 487 | // Protected by a gate in the controller, instead of policy middleware |
| 488 | 488 | Route::get('jobs/{jobPoster}/assessment-plan', 'AssessmentPlanController@getForJob'); |
| 489 | 489 | // Public, not protected by policy or gate |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | ->name('api.jobs.submit'); |
| 529 | 529 | Route::resource('jobs', 'Api\JobApiController')->only([ |
| 530 | 530 | 'show', 'store', 'update' |
| 531 | - ])->names([ // Specify custom names because default names collied with existing routes. |
|
| 531 | + ])->names([// Specify custom names because default names collied with existing routes. |
|
| 532 | 532 | 'show' => 'api.jobs.show', |
| 533 | 533 | 'store' => 'api.jobs.store', |
| 534 | 534 | 'update' => 'api.jobs.update' |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | |
| 537 | 537 | Route::resource('managers', 'Api\ManagerApiController')->only([ |
| 538 | 538 | 'show', 'update' |
| 539 | - ])->names([ // Specify custom names because default names collied with existing routes |
|
| 539 | + ])->names([// Specify custom names because default names collied with existing routes |
|
| 540 | 540 | 'show' => 'api.managers.show', |
| 541 | 541 | 'update' => 'api.managers.update' |
| 542 | 542 | ]); |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | */ |
| 66 | 66 | protected function defineGates(): void |
| 67 | 67 | { |
| 68 | - Gate::define('view-assessment-plan', function ($user, $jobPoster) { |
|
| 68 | + Gate::define('view-assessment-plan', function($user, $jobPoster) { |
|
| 69 | 69 | return $user->isAdmin() || |
| 70 | 70 | $user->isManager() && $jobPoster->manager->user_id === $user->id; |
| 71 | 71 | }); |
@@ -103,13 +103,13 @@ |
||
| 103 | 103 | $jobPoster->isClosed(); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - /** |
|
| 107 | - * Determine whether the user can view the comments. |
|
| 108 | - * |
|
| 109 | - * @param \App\Models\User $user |
|
| 110 | - * @param \App\Models\JobPoster $jobPoster |
|
| 111 | - * @return bool |
|
| 112 | - */ |
|
| 106 | + /** |
|
| 107 | + * Determine whether the user can view the comments. |
|
| 108 | + * |
|
| 109 | + * @param \App\Models\User $user |
|
| 110 | + * @param \App\Models\JobPoster $jobPoster |
|
| 111 | + * @return bool |
|
| 112 | + */ |
|
| 113 | 113 | public function viewComments(User $user, JobPoster $jobPoster) : bool |
| 114 | 114 | { |
| 115 | 115 | // Only the manager that created a comment can view the comment. |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | { |
| 16 | 16 | $job_posters = JobPoster::all(); |
| 17 | 17 | |
| 18 | - $job_posters->each(function ($job_poster) { |
|
| 18 | + $job_posters->each(function($job_poster) { |
|
| 19 | 19 | $job_poster->comments()->saveMany(factory(App\Models\Comment::class, 3)->make()); |
| 20 | 20 | }); |
| 21 | 21 | } |
@@ -24,14 +24,14 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | $faker_fr = Faker\Factory::create('fr'); |
| 26 | 26 | |
| 27 | -$factory->define(User::class, function (Faker\Generator $faker) { |
|
| 27 | +$factory->define(User::class, function(Faker\Generator $faker) { |
|
| 28 | 28 | static $password; |
| 29 | 29 | |
| 30 | 30 | return [ |
| 31 | 31 | 'first_name' => $faker->firstName(), |
| 32 | 32 | 'last_name' => $faker->lastName(), |
| 33 | 33 | 'email' => $faker->unique()->safeEmail(), |
| 34 | - 'password' => $password ? : $password = Hash::make('password'), |
|
| 34 | + 'password' => $password ?: $password = Hash::make('password'), |
|
| 35 | 35 | 'is_confirmed' => 1, |
| 36 | 36 | 'user_role_id' => UserRole::where('name', 'basic')->first()->id, // Users should default to basic user role. |
| 37 | 37 | 'remember_token' => str_random(10), |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | ]; |
| 40 | 40 | }); |
| 41 | 41 | |
| 42 | -$factory->state(User::class, 'upgradedManager', function (Faker\Generator $faker) { |
|
| 42 | +$factory->state(User::class, 'upgradedManager', function(Faker\Generator $faker) { |
|
| 43 | 43 | return [ |
| 44 | 44 | 'user_role_id' => UserRole::where('name', 'upgradedManager')->first()->id, |
| 45 | 45 | 'gov_email' => $faker->unique()->safeEmail(), |
@@ -66,29 +66,29 @@ discard block |
||
| 66 | 66 | 'is_priority' => true |
| 67 | 67 | ]); |
| 68 | 68 | |
| 69 | -$factory->define(Applicant::class, function (Faker\Generator $faker) { |
|
| 69 | +$factory->define(Applicant::class, function(Faker\Generator $faker) { |
|
| 70 | 70 | return [ |
| 71 | 71 | 'twitter_username' => $faker->firstName(), |
| 72 | 72 | 'linkedin_url' => null, |
| 73 | 73 | 'tagline' => $faker->paragraph(), |
| 74 | 74 | 'personal_website' => $faker->url(), |
| 75 | 75 | 'is_snapshot' => false, |
| 76 | - 'user_id' => function () { |
|
| 76 | + 'user_id' => function() { |
|
| 77 | 77 | return factory(User::class)->states('applicant')->create()->id; |
| 78 | 78 | }, |
| 79 | 79 | ]; |
| 80 | 80 | }); |
| 81 | 81 | |
| 82 | -$factory->define(HrAdvisor::class, function () { |
|
| 82 | +$factory->define(HrAdvisor::class, function() { |
|
| 83 | 83 | return [ |
| 84 | 84 | 'department_id' => null, |
| 85 | - 'user_id' => function () { |
|
| 85 | + 'user_id' => function() { |
|
| 86 | 86 | return factory(User::class)->state('hr_advisor')->create()->id; |
| 87 | 87 | }, |
| 88 | 88 | ]; |
| 89 | 89 | }); |
| 90 | 90 | |
| 91 | -$factory->define(Manager::class, function (Faker\Generator $faker) use ($faker_fr) { |
|
| 91 | +$factory->define(Manager::class, function(Faker\Generator $faker) use ($faker_fr) { |
|
| 92 | 92 | return [ |
| 93 | 93 | 'twitter_username' => $faker->firstName(), |
| 94 | 94 | 'linkedin_url' => null, |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | 'development_opportunity_frequency_id' => Frequency::inRandomOrder()->first()->id, |
| 100 | 100 | 'refuse_low_value_work_frequency_id' => Frequency::inRandomOrder()->first()->id, |
| 101 | 101 | 'years_experience' => $faker->numberBetween(2, 25), |
| 102 | - 'user_id' => function () use ($faker) { |
|
| 102 | + 'user_id' => function() use ($faker) { |
|
| 103 | 103 | return factory(User::class)->create([ |
| 104 | 104 | 'gov_email' => $faker->unique()->safeEmail(), |
| 105 | 105 | ])->id; |
@@ -128,12 +128,12 @@ discard block |
||
| 128 | 128 | }); |
| 129 | 129 | |
| 130 | 130 | $factory->state(Manager::class, 'upgraded', [ |
| 131 | - 'user_id' => function () { |
|
| 131 | + 'user_id' => function() { |
|
| 132 | 132 | return factory(User::class)->state('upgradedManager')->create()->id; |
| 133 | 133 | }, |
| 134 | 134 | ]); |
| 135 | 135 | |
| 136 | -$factory->afterCreating(Manager::class, function ($manager) : void { |
|
| 136 | +$factory->afterCreating(Manager::class, function($manager) : void { |
|
| 137 | 137 | $manager->team_culture()->save(factory(TeamCulture::class)->create([ |
| 138 | 138 | 'manager_id' => $manager->id, |
| 139 | 139 | ])); |