Passed
Push — feature/immutable-application-... ( 724692...212613 )
by Chris
34:25 queued 17:29
created
app/Policies/AssessmentPlanNotificationPolicy.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/Policies/ReferencePolicy.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
      * @param  \App\Models\Reference  $reference
18 18
      * @return mixed
19 19
      */
20
-    public function view(User $user, Reference $reference)
20
+    public function view (User $user, Reference $reference)
21 21
     {
22
-        return $user->isApplicant()
22
+        return $user->isApplicant ()
23 23
             && $reference->referenceable instanceof Applicant
24
-            && $reference->referenceable->user->is($user);
24
+            && $reference->referenceable->user->is ($user);
25 25
     }
26 26
 
27 27
     /**
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
      * @param  \App\Models\User  $user
31 31
      * @return mixed
32 32
      */
33
-    public function create(User $user)
33
+    public function create (User $user)
34 34
     {
35
-        return $user->isApplicant();
35
+        return $user->isApplicant ();
36 36
     }
37 37
 
38 38
     /**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
      * @param  \App\Models\Reference  $reference
43 43
      * @return mixed
44 44
      */
45
-    public function update(User $user, Reference $reference)
45
+    public function update (User $user, Reference $reference)
46 46
     {
47
-        return $user->isApplicant()
47
+        return $user->isApplicant ()
48 48
             && $reference->referenceable instanceof Applicant
49
-            && $reference->referenceable->user->is($user);
49
+            && $reference->referenceable->user->is ($user);
50 50
     }
51 51
 
52 52
     /**
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
      * @param  \App\Models\Reference  $reference
57 57
      * @return mixed
58 58
      */
59
-    public function delete(User $user, Reference $reference)
59
+    public function delete (User $user, Reference $reference)
60 60
     {
61
-        return $user->isApplicant()
61
+        return $user->isApplicant ()
62 62
             && $reference->referenceable instanceof Applicant
63
-            && $reference->referenceable->user->is($user);
63
+            && $reference->referenceable->user->is ($user);
64 64
     }
65 65
 }
Please login to merge, or discard this patch.
app/Policies/ManagerPolicy.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
app/Policies/JobPolicy.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/Policies/RatingGuideQuestionPolicy.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/Policies/WorkExperiencePolicy.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
      * @param  \App\Models\WorkExperience  $workExperience
18 18
      * @return mixed
19 19
      */
20
-    public function view(User $user, WorkExperience $workExperience)
20
+    public function view (User $user, WorkExperience $workExperience)
21 21
     {
22
-        return $user->isApplicant()
22
+        return $user->isApplicant ()
23 23
             && $workExperience->experienceable instanceof Applicant
24
-            && $workExperience->experienceable->user->is($user);
24
+            && $workExperience->experienceable->user->is ($user);
25 25
     }
26 26
 
27 27
     /**
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
      * @param  \App\Models\User  $user
31 31
      * @return mixed
32 32
      */
33
-    public function create(User $user)
33
+    public function create (User $user)
34 34
     {
35
-        return $user->isApplicant();
35
+        return $user->isApplicant ();
36 36
     }
37 37
 
38 38
     /**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
      * @param  \App\Models\WorkExperience  $workExperience
43 43
      * @return mixed
44 44
      */
45
-    public function update(User $user, WorkExperience $workExperience)
45
+    public function update (User $user, WorkExperience $workExperience)
46 46
     {
47
-        return $user->isApplicant()
47
+        return $user->isApplicant ()
48 48
             && $workExperience->experienceable instanceof Applicant
49
-            && $workExperience->experienceable->user->is($user);
49
+            && $workExperience->experienceable->user->is ($user);
50 50
     }
51 51
 
52 52
     /**
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
      * @param  \App\Models\WorkExperience  $workExperience
57 57
      * @return mixed
58 58
      */
59
-    public function delete(User $user, WorkExperience $workExperience)
59
+    public function delete (User $user, WorkExperience $workExperience)
60 60
     {
61
-        return $user->isApplicant()
61
+        return $user->isApplicant ()
62 62
             && $workExperience->experienceable instanceof Applicant
63
-            && $workExperience->experienceable->user->is($user);
63
+            && $workExperience->experienceable->user->is ($user);
64 64
     }
65 65
 }
Please login to merge, or discard this patch.
app/Policies/WorkSamplePolicy.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
      * @param  \App\Models\WorkSample  $workSample
18 18
      * @return mixed
19 19
      */
20
-    public function view(User $user, WorkSample $workSample)
20
+    public function view (User $user, WorkSample $workSample)
21 21
     {
22
-        return $user->isApplicant()
22
+        return $user->isApplicant ()
23 23
             && $workSample->work_sampleable instanceof Applicant
24
-            && $workSample->work_sampleable->user->is($user);
24
+            && $workSample->work_sampleable->user->is ($user);
25 25
     }
26 26
 
27 27
     /**
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
      * @param  \App\Models\User  $user
31 31
      * @return mixed
32 32
      */
33
-    public function create(User $user)
33
+    public function create (User $user)
34 34
     {
35
-        return $user->isApplicant();
35
+        return $user->isApplicant ();
36 36
     }
37 37
 
38 38
     /**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
      * @param  \App\Models\WorkSample  $workSample
43 43
      * @return mixed
44 44
      */
45
-    public function update(User $user, WorkSample $workSample)
45
+    public function update (User $user, WorkSample $workSample)
46 46
     {
47
-        return $user->isApplicant()
47
+        return $user->isApplicant ()
48 48
             && $workSample->work_sampleable instanceof Applicant
49
-            && $workSample->work_sampleable->user->is($user);
49
+            && $workSample->work_sampleable->user->is ($user);
50 50
     }
51 51
 
52 52
     /**
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
      * @param  \App\Models\WorkSample  $workSample
57 57
      * @return mixed
58 58
      */
59
-    public function delete(User $user, WorkSample $workSample)
59
+    public function delete (User $user, WorkSample $workSample)
60 60
     {
61
-        return $user->isApplicant()
61
+        return $user->isApplicant ()
62 62
             && $workSample->work_sampleable instanceof Applicant
63
-            && $workSample->work_sampleable->user->is($user);
63
+            && $workSample->work_sampleable->user->is ($user);
64 64
     }
65 65
 }
Please login to merge, or discard this patch.
app/Policies/ApplicantPolicy.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,21 +17,21 @@  discard block
 block discarded – undo
17 17
      * @param  \App\Models\Applicant $applicant Applicant object used within applications submitted to Job Poster.
18 18
      * @return boolean
19 19
      */
20
-    protected function ownsJobApplicantAppliedTo(User $user, Applicant $applicant)
20
+    protected function ownsJobApplicantAppliedTo (User $user, Applicant $applicant)
21 21
     {
22 22
         $applicant_id = $applicant->id;
23 23
         $user_id = $user->id;
24
-        return JobPoster::whereHas(
24
+        return JobPoster::whereHas (
25 25
             'manager',
26 26
             function ($q) use ($user_id) {
27
-                $q->where('user_id', $user_id);
27
+                $q->where ('user_id', $user_id);
28 28
             }
29
-        )->whereHas(
29
+        )->whereHas (
30 30
             'submitted_applications',
31 31
             function ($q) use ($applicant_id) {
32
-                    $q->where('applicant_id', $applicant_id);
32
+                    $q->where ('applicant_id', $applicant_id);
33 33
             }
34
-        )->get()->isNotEmpty();
34
+        )->get ()->isNotEmpty ();
35 35
     }
36 36
 
37 37
     /**
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
      * @param  \App\Models\Applicant $applicant Applicant object to be viewed.
42 42
      * @return boolean
43 43
      */
44
-    public function view(User $user, Applicant $applicant)
44
+    public function view (User $user, Applicant $applicant)
45 45
     {
46
-        $authApplicant =  $user->isApplicant() &&
47
-            $applicant->user->is($user);
48
-        $authManager = $user->isManager() && $this->ownsJobApplicantAppliedTo($user, $applicant);
46
+        $authApplicant = $user->isApplicant () &&
47
+            $applicant->user->is ($user);
48
+        $authManager = $user->isManager () && $this->ownsJobApplicantAppliedTo ($user, $applicant);
49 49
         return $authApplicant || $authManager;
50 50
     }
51 51
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @param  \App\Models\User $user User object making the create request.
56 56
      * @return boolean
57 57
      */
58
-    public function create(User $user)
58
+    public function create (User $user)
59 59
     {
60 60
         return false;
61 61
     }
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
      * @param  \App\Models\Applicant $applicant Applicant object being updated.
68 68
      * @return boolean
69 69
      */
70
-    public function update(User $user, Applicant $applicant)
70
+    public function update (User $user, Applicant $applicant)
71 71
     {
72
-        return $user->isApplicant() &&
72
+        return $user->isApplicant () &&
73 73
             $applicant->user_id === $user->id;
74 74
     }
75 75
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      * @param  \App\Models\Applicant $applicant Applicant object being deleted.
81 81
      * @return void
82 82
      */
83
-    public function delete(User $user, Applicant $applicant)
83
+    public function delete (User $user, Applicant $applicant)
84 84
     {
85 85
     }
86 86
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * @param  \App\Models\Applicant $applicant Applicant object being restored.
92 92
      * @return void
93 93
      */
94
-    public function restore(User $user, Applicant $applicant)
94
+    public function restore (User $user, Applicant $applicant)
95 95
     {
96 96
     }
97 97
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * @param  \App\Models\Applicant $applicant Applicant object being forceDeleted.
103 103
      * @return void
104 104
      */
105
-    public function forceDelete(User $user, Applicant $applicant)
105
+    public function forceDelete (User $user, Applicant $applicant)
106 106
     {
107 107
     }
108 108
 }
Please login to merge, or discard this patch.
app/Policies/CoursePolicy.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
      * @param  \App\Models\Course  $course
18 18
      * @return mixed
19 19
      */
20
-    public function view(User $user, Course $course)
20
+    public function view (User $user, Course $course)
21 21
     {
22
-        return $user->isApplicant()
22
+        return $user->isApplicant ()
23 23
             && $course->courseable instanceof Applicant
24 24
             && $course->courseable->user->id === $user->id;
25 25
     }
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
      * @param  \App\Models\User  $user
31 31
      * @return mixed
32 32
      */
33
-    public function create(User $user)
33
+    public function create (User $user)
34 34
     {
35
-        return $user->isApplicant();
35
+        return $user->isApplicant ();
36 36
     }
37 37
 
38 38
     /**
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
      * @param  \App\Models\Course  $course
43 43
      * @return mixed
44 44
      */
45
-    public function update(User $user, Course $course)
45
+    public function update (User $user, Course $course)
46 46
     {
47
-        return $user->isApplicant()
47
+        return $user->isApplicant ()
48 48
             && $course->courseable instanceof Applicant
49 49
             && $course->courseable->user->id === $user->id;
50 50
     }
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
      * @param  \App\Models\Course  $course
57 57
      * @return mixed
58 58
      */
59
-    public function delete(User $user, Course $course)
59
+    public function delete (User $user, Course $course)
60 60
     {
61
-        return $user->isApplicant()
61
+        return $user->isApplicant ()
62 62
             && $course->courseable instanceof Applicant
63 63
             && $course->courseable->user->id === $user->id;
64 64
     }
Please login to merge, or discard this patch.