@@ -5,16 +5,16 @@ |
||
| 5 | 5 | // -------------------------- |
| 6 | 6 | // This route file is loaded automatically by Backpack\Base. |
| 7 | 7 | // Routes you generate using Backpack\Generators will be placed here. |
| 8 | -Route::group([ |
|
| 9 | - 'prefix' => config('backpack.base.route_prefix', 'admin'), |
|
| 10 | - 'middleware' => ['web', config('backpack.base.middleware_key', 'admin')], |
|
| 8 | +Route::group ([ |
|
| 9 | + 'prefix' => config ('backpack.base.route_prefix', 'admin'), |
|
| 10 | + 'middleware' => ['web', config ('backpack.base.middleware_key', 'admin')], |
|
| 11 | 11 | 'namespace' => 'App\Http\Controllers\Admin', |
| 12 | 12 | ], function () : void { |
| 13 | 13 | // Custom admin routes. |
| 14 | - Route::crud('skill', 'SkillCrudController'); |
|
| 15 | - Route::crud('job-poster', 'JobPosterCrudController'); |
|
| 16 | - Route::crud('user', 'UserCrudController'); |
|
| 17 | - Route::crud('manager', 'ManagerCrudController'); |
|
| 18 | - Route::crud('department', 'DepartmentCrudController'); |
|
| 19 | - Route::crud('classification', 'ClassificationCrudController'); |
|
| 14 | + Route::crud ('skill', 'SkillCrudController'); |
|
| 15 | + Route::crud ('job-poster', 'JobPosterCrudController'); |
|
| 16 | + Route::crud ('user', 'UserCrudController'); |
|
| 17 | + Route::crud ('manager', 'ManagerCrudController'); |
|
| 18 | + Route::crud ('department', 'DepartmentCrudController'); |
|
| 19 | + Route::crud ('classification', 'ClassificationCrudController'); |
|
| 20 | 20 | }); |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | * @param \App\Models\RatingGuideAnswer $answer |
| 17 | 17 | * @return boolean |
| 18 | 18 | */ |
| 19 | - public function view(User $user, RatingGuideAnswer $answer): bool |
|
| 19 | + public function view (User $user, RatingGuideAnswer $answer): bool |
|
| 20 | 20 | { |
| 21 | 21 | // Managers can view answers tied to Jobs they own. |
| 22 | - return $user->isManager() && |
|
| 22 | + return $user->isManager () && |
|
| 23 | 23 | $answer->rating_guide_question->job_poster->manager->user_id === $user->id; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | * @param \App\Models\User $user |
| 30 | 30 | * @return boolean |
| 31 | 31 | */ |
| 32 | - public function create(User $user): bool |
|
| 32 | + public function create (User $user): bool |
|
| 33 | 33 | { |
| 34 | 34 | //Any manager can create a new RatingGuideAnswer, but only for questions they own. |
| 35 | - return $user->isManager(); |
|
| 35 | + return $user->isManager (); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | * @param \App\Models\RatingGuideAnswer $answer |
| 43 | 43 | * @return boolean |
| 44 | 44 | */ |
| 45 | - public function update(User $user, RatingGuideAnswer $answer): bool |
|
| 45 | + public function update (User $user, RatingGuideAnswer $answer): bool |
|
| 46 | 46 | { |
| 47 | 47 | // Managers can edit answers tied to Jobs they own. |
| 48 | - return $user->isManager() && |
|
| 48 | + return $user->isManager () && |
|
| 49 | 49 | $answer->rating_guide_question->job_poster->manager->user_id === $user->id; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return boolean |
| 59 | 59 | */ |
| 60 | - public function delete(User $user, RatingGuideAnswer $answer) : bool |
|
| 60 | + public function delete (User $user, RatingGuideAnswer $answer) : bool |
|
| 61 | 61 | { |
| 62 | 62 | // Managers can delete answers tied to Jobs they own. |
| 63 | - return $user->isManager() && |
|
| 63 | + return $user->isManager () && |
|
| 64 | 64 | $answer->rating_guide_question->job_poster->manager->user_id === $user->id; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | * @param \App\JobApplication $jobApplication |
| 19 | 19 | * @return mixed |
| 20 | 20 | */ |
| 21 | - public function view(User $user, JobApplication $jobApplication) |
|
| 21 | + public function view (User $user, JobApplication $jobApplication) |
|
| 22 | 22 | { |
| 23 | - $authApplicant = ($user->isApplicant() && |
|
| 23 | + $authApplicant = ($user->isApplicant () && |
|
| 24 | 24 | $user->applicant->id === $jobApplication->applicant_id); |
| 25 | - $authManager = ($user->isManager() && |
|
| 26 | - $jobApplication->job_poster->manager->user->is($user)); |
|
| 25 | + $authManager = ($user->isManager () && |
|
| 26 | + $jobApplication->job_poster->manager->user->is ($user)); |
|
| 27 | 27 | |
| 28 | - return $authApplicant||$authManager; |
|
| 28 | + return $authApplicant || $authManager; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param \App\Models\User $user |
| 35 | 35 | * @return mixed |
| 36 | 36 | */ |
| 37 | - public function create(User $user) |
|
| 37 | + public function create (User $user) |
|
| 38 | 38 | { |
| 39 | 39 | return true; |
| 40 | 40 | } |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | * @param \App\JobApplication $jobApplication |
| 47 | 47 | * @return mixed |
| 48 | 48 | */ |
| 49 | - public function update(User $user, JobApplication $jobApplication) |
|
| 49 | + public function update (User $user, JobApplication $jobApplication) |
|
| 50 | 50 | { |
| 51 | - return $user->isApplicant() && |
|
| 51 | + return $user->isApplicant () && |
|
| 52 | 52 | $user->applicant->id === $jobApplication->applicant_id && |
| 53 | 53 | $jobApplication->application_status->name == 'draft' && |
| 54 | - $jobApplication->job_poster->isOpen(); |
|
| 54 | + $jobApplication->job_poster->isOpen (); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | * @param \App\JobApplication $jobApplication |
| 62 | 62 | * @return mixed |
| 63 | 63 | */ |
| 64 | - public function delete(User $user, JobApplication $jobApplication) |
|
| 64 | + public function delete (User $user, JobApplication $jobApplication) |
|
| 65 | 65 | { |
| 66 | - return $user->isApplicant() && |
|
| 66 | + return $user->isApplicant () && |
|
| 67 | 67 | $user->applicant->id === $jobApplication->applicant_id && |
| 68 | 68 | $jobApplication->application_status->name == 'draft'; |
| 69 | 69 | } |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | * @param \App\JobApplication $jobApplication |
| 76 | 76 | * @return mixed |
| 77 | 77 | */ |
| 78 | - public function review(User $user, JobApplication $jobApplication) |
|
| 78 | + public function review (User $user, JobApplication $jobApplication) |
|
| 79 | 79 | { |
| 80 | 80 | // Only the manager in charge of the accompanying job can review an application, |
| 81 | 81 | // and only if it has been submitted |
| 82 | - return $user->isManager() && |
|
| 82 | + return $user->isManager () && |
|
| 83 | 83 | $jobApplication->job_poster->manager->user->id == $user->id && |
| 84 | 84 | $jobApplication->application_status->name != 'draft'; |
| 85 | 85 | } |
@@ -9,11 +9,11 @@ |
||
| 9 | 9 | { |
| 10 | 10 | use HandlesAuthorization; |
| 11 | 11 | |
| 12 | - public function before($user, $ability) |
|
| 12 | + public function before ($user, $ability) |
|
| 13 | 13 | { |
| 14 | - if ($user->isAdmin()) { |
|
| 14 | + if ($user->isAdmin ()) { |
|
| 15 | 15 | $userText = '{id='.$user->id.'}'; |
| 16 | - Log::notice('User '.$userText.' has bypassed policy as an Admin'); |
|
| 16 | + Log::notice ('User '.$userText.' has bypassed policy as an Admin'); |
|
| 17 | 17 | return true; |
| 18 | 18 | } |
| 19 | 19 | } |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | * @param \App\Models\Assessment $assessment |
| 17 | 17 | * @return boolean |
| 18 | 18 | */ |
| 19 | - public function view(User $user, Assessment $assessment): bool |
|
| 19 | + public function view (User $user, Assessment $assessment): bool |
|
| 20 | 20 | { |
| 21 | 21 | // Managers can view assessments tied to Jobs they own. |
| 22 | - return $user->isManager() && |
|
| 22 | + return $user->isManager () && |
|
| 23 | 23 | $assessment->criterion->job_poster->manager->user_id === $user->id; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | * @param \App\Models\User $user |
| 30 | 30 | * @return boolean |
| 31 | 31 | */ |
| 32 | - public function create(User $user): bool |
|
| 32 | + public function create (User $user): bool |
|
| 33 | 33 | { |
| 34 | 34 | //Any manager can create a new Assessment, but only for criteria they own. |
| 35 | - return $user->isManager(); |
|
| 35 | + return $user->isManager (); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | * @param \App\Models\Assessment $assessment |
| 43 | 43 | * @return boolean |
| 44 | 44 | */ |
| 45 | - public function update(User $user, Assessment $assessment): bool |
|
| 45 | + public function update (User $user, Assessment $assessment): bool |
|
| 46 | 46 | { |
| 47 | 47 | // Managers can edit assessments tied to Jobs they own. |
| 48 | - return $user->isManager() && |
|
| 48 | + return $user->isManager () && |
|
| 49 | 49 | $assessment->criterion->job_poster->manager->user_id === $user->id; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return boolean |
| 59 | 59 | */ |
| 60 | - public function delete(User $user, Assessment $assessment) : bool |
|
| 60 | + public function delete (User $user, Assessment $assessment) : bool |
|
| 61 | 61 | { |
| 62 | 62 | // Managers can delete assessments tied to Jobs they own. |
| 63 | - return $user->isManager() && |
|
| 63 | + return $user->isManager () && |
|
| 64 | 64 | $assessment->criterion->job_poster->manager->user_id === $user->id; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | * @param \App\Models\AssessmentPlanNotification $notification |
| 17 | 17 | * @return boolean |
| 18 | 18 | */ |
| 19 | - public function view(User $user, AssessmentPlanNotification $notification): bool |
|
| 19 | + public function view (User $user, AssessmentPlanNotification $notification): bool |
|
| 20 | 20 | { |
| 21 | 21 | // Managers can view notifications tied to Jobs they own. |
| 22 | - return $user->isManager() && |
|
| 22 | + return $user->isManager () && |
|
| 23 | 23 | $notification->job_poster->manager->user_id === $user->id; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | * @param \App\Models\User $user |
| 30 | 30 | * @return boolean |
| 31 | 31 | */ |
| 32 | - public function create(User $user): bool |
|
| 32 | + public function create (User $user): bool |
|
| 33 | 33 | { |
| 34 | 34 | //Any manager can create a new AssessmentPlanNotification, but only for job posters they own. |
| 35 | - return $user->isManager(); |
|
| 35 | + return $user->isManager (); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | * @param \App\Models\AssessmentPlanNotification $notification |
| 43 | 43 | * @return boolean |
| 44 | 44 | */ |
| 45 | - public function update(User $user, AssessmentPlanNotification $notification): bool |
|
| 45 | + public function update (User $user, AssessmentPlanNotification $notification): bool |
|
| 46 | 46 | { |
| 47 | 47 | // Managers can edit notifications tied to Jobs they own. |
| 48 | - return $user->isManager() && |
|
| 48 | + return $user->isManager () && |
|
| 49 | 49 | $notification->job_poster->manager->user_id === $user->id; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return boolean |
| 59 | 59 | */ |
| 60 | - public function delete(User $user, AssessmentPlanNotification $notification) : bool |
|
| 60 | + public function delete (User $user, AssessmentPlanNotification $notification) : bool |
|
| 61 | 61 | { |
| 62 | 62 | // Managers can delete notifications tied to Jobs they own. |
| 63 | - return $user->isManager() && |
|
| 63 | + return $user->isManager () && |
|
| 64 | 64 | $notification->job_poster->manager->user_id === $user->id; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @param \App\Models\Manager $manager |
| 17 | 17 | * @return mixed |
| 18 | 18 | */ |
| 19 | - public function view(User $user, Manager $manager) |
|
| 19 | + public function view (User $user, Manager $manager) |
|
| 20 | 20 | { |
| 21 | 21 | //Manager profiles are viewable by any logged-in user |
| 22 | 22 | return $user != null; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @param \App\Models\User $user |
| 29 | 29 | * @return mixed |
| 30 | 30 | */ |
| 31 | - public function create(User $user) |
|
| 31 | + public function create (User $user) |
|
| 32 | 32 | { |
| 33 | 33 | return false; |
| 34 | 34 | } |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | * @param \App\Models\Manager $manager |
| 41 | 41 | * @return mixed |
| 42 | 42 | */ |
| 43 | - public function update(User $user, Manager $manager) |
|
| 43 | + public function update (User $user, Manager $manager) |
|
| 44 | 44 | { |
| 45 | 45 | //Mangers can only update their own profiles |
| 46 | - return $user->isManager() && |
|
| 46 | + return $user->isManager () && |
|
| 47 | 47 | $manager->user_id == $user->id; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param \App\Models\Manager $manager |
| 55 | 55 | * @return mixed |
| 56 | 56 | */ |
| 57 | - public function delete(User $user, Manager $manager) |
|
| 57 | + public function delete (User $user, Manager $manager) |
|
| 58 | 58 | { |
| 59 | 59 | return false; |
| 60 | 60 | } |
@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | * @param \App\Models\JobPoster $jobPoster |
| 18 | 18 | * @return mixed |
| 19 | 19 | */ |
| 20 | - public function view(?User $user, JobPoster $jobPoster) |
|
| 20 | + public function view (?User $user, JobPoster $jobPoster) |
|
| 21 | 21 | { |
| 22 | 22 | // Anyone can view a published job |
| 23 | 23 | // Only the manager that created it can view an unpublished job |
| 24 | - return $jobPoster->status() == 'published' || $jobPoster->status() == 'closed' || |
|
| 24 | + return $jobPoster->status () == 'published' || $jobPoster->status () == 'closed' || |
|
| 25 | 25 | ( |
| 26 | 26 | $user && |
| 27 | - $user->isManager() && |
|
| 27 | + $user->isManager () && |
|
| 28 | 28 | $jobPoster->manager->user_id == $user->id |
| 29 | 29 | ); |
| 30 | 30 | } |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | * @param \App\Models\User $user User to test against. |
| 36 | 36 | * @return mixed |
| 37 | 37 | */ |
| 38 | - public function create(User $user) |
|
| 38 | + public function create (User $user) |
|
| 39 | 39 | { |
| 40 | 40 | // Any manager can create a new job poster. |
| 41 | - return $user->isManager(); |
|
| 41 | + return $user->isManager (); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | * @param \App\Models\JobPoster $jobPoster |
| 49 | 49 | * @return mixed |
| 50 | 50 | */ |
| 51 | - public function update(User $user, JobPoster $jobPoster) |
|
| 51 | + public function update (User $user, JobPoster $jobPoster) |
|
| 52 | 52 | { |
| 53 | 53 | // Only managers can edit jobs, and only their own, managers can't publish jobs or edit published jobs |
| 54 | - return $user->isManager() && |
|
| 54 | + return $user->isManager () && |
|
| 55 | 55 | $jobPoster->manager->user->id == $user->id && |
| 56 | 56 | !$jobPoster->published; |
| 57 | 57 | } |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return boolean |
| 66 | 66 | */ |
| 67 | - public function delete(User $user, JobPoster $jobPoster) : bool |
|
| 67 | + public function delete (User $user, JobPoster $jobPoster) : bool |
|
| 68 | 68 | { |
| 69 | 69 | // Jobs can only be deleted when they're in the 'draft' |
| 70 | 70 | // state, and only by managers that created them. |
| 71 | - return $user->isManager() && |
|
| 71 | + return $user->isManager () && |
|
| 72 | 72 | $jobPoster->manager->user->id == $user->id && |
| 73 | 73 | !$jobPoster->published; |
| 74 | 74 | } |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | * @param \App\Models\JobPoster $jobPoster |
| 81 | 81 | * @return mixed |
| 82 | 82 | */ |
| 83 | - public function submitForReview(User $user, JobPoster $jobPoster) |
|
| 83 | + public function submitForReview (User $user, JobPoster $jobPoster) |
|
| 84 | 84 | { |
| 85 | 85 | // Only upgradedManagers can submit jobs for review, only their own jobs, and only if they're still drafts. |
| 86 | 86 | // NOTE: this is one of the only permissions to require an upgradedManager, as opposed to a demoManager.var |
| 87 | - return $user->isUpgradedManager() && |
|
| 87 | + return $user->isUpgradedManager () && |
|
| 88 | 88 | $jobPoster->manager->user->id == $user->id && |
| 89 | - $jobPoster->status() === 'draft'; |
|
| 89 | + $jobPoster->status () === 'draft'; |
|
| 90 | 90 | } |
| 91 | 91 | /** |
| 92 | 92 | * Determine whether the user can review applications to the job poster. |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | * @param \App\Models\JobPoster $jobPoster |
| 96 | 96 | * @return mixed |
| 97 | 97 | */ |
| 98 | - public function reviewApplicationsFor(User $user, JobPoster $jobPoster) |
|
| 98 | + public function reviewApplicationsFor (User $user, JobPoster $jobPoster) |
|
| 99 | 99 | { |
| 100 | 100 | // Only managers can review applications, and only for their own jobs. |
| 101 | - return $user->isManager() && |
|
| 101 | + return $user->isManager () && |
|
| 102 | 102 | $jobPoster->manager->user->id == $user->id && |
| 103 | - $jobPoster->isClosed(); |
|
| 103 | + $jobPoster->isClosed (); |
|
| 104 | 104 | } |
| 105 | 105 | } |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | * @param \App\Models\RatingGuideQuestion $question |
| 17 | 17 | * @return boolean |
| 18 | 18 | */ |
| 19 | - public function view(User $user, RatingGuideQuestion $question): bool |
|
| 19 | + public function view (User $user, RatingGuideQuestion $question): bool |
|
| 20 | 20 | { |
| 21 | 21 | // Managers can view questions tied to Jobs they own. |
| 22 | - return $user->isManager() && |
|
| 22 | + return $user->isManager () && |
|
| 23 | 23 | $question->job_poster->manager->user_id === $user->id; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | * @param \App\Models\User $user |
| 30 | 30 | * @return boolean |
| 31 | 31 | */ |
| 32 | - public function create(User $user): bool |
|
| 32 | + public function create (User $user): bool |
|
| 33 | 33 | { |
| 34 | 34 | //Any manager can create a new RatingGuideQuestion, but only for jobs they own. |
| 35 | - return $user->isManager(); |
|
| 35 | + return $user->isManager (); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | * @param \App\Models\RatingGuideQuestion $question |
| 43 | 43 | * @return boolean |
| 44 | 44 | */ |
| 45 | - public function update(User $user, RatingGuideQuestion $question): bool |
|
| 45 | + public function update (User $user, RatingGuideQuestion $question): bool |
|
| 46 | 46 | { |
| 47 | 47 | // Managers can edit questions tied to Jobs they own. |
| 48 | - return $user->isManager() && |
|
| 48 | + return $user->isManager () && |
|
| 49 | 49 | $question->job_poster->manager->user_id === $user->id; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return boolean |
| 59 | 59 | */ |
| 60 | - public function delete(User $user, RatingGuideQuestion $question) : bool |
|
| 60 | + public function delete (User $user, RatingGuideQuestion $question) : bool |
|
| 61 | 61 | { |
| 62 | 62 | // Managers can delete questions tied to Jobs they own. |
| 63 | - return $user->isManager() && |
|
| 63 | + return $user->isManager () && |
|
| 64 | 64 | $question->job_poster->manager->user_id === $user->id; |
| 65 | 65 | } |
| 66 | 66 | } |