Passed
Push — task/add-manager-resource ( c74771 )
by Chris
11:48
created
app/Http/Controllers/Auth/ResetPasswordController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     protected function redirectTo()
33 33
     {
34
-        $redirectTo = WhichPortal::isManagerPortal() ? route('manager.home') : route('home');
34
+        $redirectTo = WhichPortal::isManagerPortal () ? route('manager.home') : route ('home');
35 35
         return $redirectTo;
36 36
     }
37 37
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function __construct()
44 44
     {
45
-        $this->middleware('guest');
45
+        $this->middleware ('guest');
46 46
     }
47 47
 
48 48
     /**
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function showResetForm(Request $request, $token = null)
58 58
     {
59
-        return view('auth.passwords.reset')->with([
59
+        return view ('auth.passwords.reset')->with ([
60 60
             'token' => $token,
61 61
             'email' => $request->email,
62
-            'routes' => $this->auth_routes(),
63
-            'reset_password' => Lang::get('common/auth/reset_password'),
62
+            'routes' => $this->auth_routes (),
63
+            'reset_password' => Lang::get ('common/auth/reset_password'),
64 64
         ]);
65 65
     }
66 66
 
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/RegisterController.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     protected function redirectTo()
39 39
     {
40
-        $redirectTo = WhichPortal::isManagerPortal() ? route('manager.home') : route('home');
40
+        $redirectTo = WhichPortal::isManagerPortal () ? route('manager.home') : route ('home');
41 41
         return $redirectTo;
42 42
     }
43 43
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function __construct()
50 50
     {
51
-        $this->middleware('guest');
51
+        $this->middleware ('guest');
52 52
     }
53 53
 
54 54
     /**
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function showRegistrationForm()
60 60
     {
61
-        return view('auth.register', [
62
-            'routes' => $this->auth_routes(),
63
-            'register' => Lang::get('common/auth/register'),
64
-            'home_url' => route('home'),
61
+        return view ('auth.register', [
62
+            'routes' => $this->auth_routes (),
63
+            'register' => Lang::get ('common/auth/register'),
64
+            'home_url' => route ('home'),
65 65
         ]);
66 66
     }
67 67
 
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function showManagerRegistrationForm()
74 74
     {
75
-        return view('auth.register_manager', [
76
-            'routes' => $this->auth_routes(),
77
-            'register' => Lang::get('common/auth/register'),
78
-            'not_in_gov_option' => ['value' => 0, 'name' => Lang::get('common/auth/register.not_in_gov')],
79
-            'departments' => Department::all(),
80
-            'home_url' => route('manager.home'),
75
+        return view ('auth.register_manager', [
76
+            'routes' => $this->auth_routes (),
77
+            'register' => Lang::get ('common/auth/register'),
78
+            'not_in_gov_option' => ['value' => 0, 'name' => Lang::get ('common/auth/register.not_in_gov')],
79
+            'departments' => Department::all (),
80
+            'home_url' => route ('manager.home'),
81 81
         ]);
82 82
     }
83 83
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     protected function validator(array $data)
92 92
     {
93
-        return RegistrationValidator::userValidator($data);
93
+        return RegistrationValidator::userValidator ($data);
94 94
     }
95 95
 
96 96
     /**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     protected function managerValidator(array $data)
103 103
     {
104
-        return RegistrationValidator::managerValidator($data);
104
+        return RegistrationValidator::managerValidator ($data);
105 105
     }
106 106
 
107 107
     /**
@@ -112,20 +112,20 @@  discard block
 block discarded – undo
112 112
      */
113 113
     protected function create(array $data)
114 114
     {
115
-        $user = new User();
115
+        $user = new User ();
116 116
         $user->first_name = $data['first_name'];
117 117
         $user->last_name = $data['last_name'];
118 118
         $user->email = $data['email'];
119
-        $user->password = Hash::make($data['password']);
119
+        $user->password = Hash::make ($data['password']);
120 120
 
121 121
         // Default to basic user.
122
-        $user->setRole('basic');
122
+        $user->setRole ('basic');
123 123
 
124
-        $user->save();
124
+        $user->save ();
125 125
 
126
-        $user->applicant()->save(new Applicant());
126
+        $user->applicant ()->save (new Applicant ());
127 127
 
128
-        return $user->fresh();
128
+        return $user->fresh ();
129 129
     }
130 130
 
131 131
     /**
@@ -137,28 +137,28 @@  discard block
 block discarded – undo
137 137
     protected function createManager(array $data)
138 138
     {
139 139
         // Create basic user.
140
-        $user = $this->create($data);
140
+        $user = $this->create ($data);
141 141
 
142 142
         // Save manager specific fields.
143
-        $managerDepartment = Department::find($data['department']);
143
+        $managerDepartment = Department::find ($data['department']);
144 144
         $inGovernment = ($managerDepartment !== null);
145 145
         $user->not_in_gov = !$inGovernment;
146 146
         $user->gov_email = $inGovernment ? $data['gov_email'] : null;
147
-        $user->save();
148
-        $user->refresh();
147
+        $user->save ();
148
+        $user->refresh ();
149 149
 
150 150
         // Add (or update) manager profile.
151 151
         // NOTE: modifying a field in $user, and saving it, appears to create Manager object. I don't know how. -- Tristan
152 152
         // That means that after setting not_in_gov or gov_email, a manager already exists here. Adding a new one will throw an exception.
153 153
         $department_id = $inGovernment ? $managerDepartment->id : null;
154 154
         if ($user->manager === null) {
155
-            $user->applicant()->save(new Manager());
156
-            $user->refresh();
155
+            $user->applicant ()->save (new Manager ());
156
+            $user->refresh ();
157 157
         }
158 158
         $user->manager->department_id = $department_id;
159
-        $user->manager->save();
159
+        $user->manager->save ();
160 160
 
161
-        return $user->fresh();
161
+        return $user->fresh ();
162 162
     }
163 163
 
164 164
     /**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      */
172 172
     protected function registered(Request $request, $user)
173 173
     {
174
-        return redirect()->intended($this->redirectTo());
174
+        return redirect ()->intended ($this->redirectTo ());
175 175
     }
176 176
 
177 177
     /**
@@ -183,13 +183,13 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public function registerManager(Request $request)
185 185
     {
186
-        $this->managerValidator($request->all())->validate();
186
+        $this->managerValidator ($request->all ())->validate ();
187 187
 
188
-        event(new Registered($user = $this->createManager($request->all())));
188
+        event (new Registered ($user = $this->createManager ($request->all ())));
189 189
 
190
-        $this->guard()->login($user);
190
+        $this->guard ()->login ($user);
191 191
 
192
-        return $this->registered($request, $user)
193
-            ?: redirect($this->redirectPath());
192
+        return $this->registered ($request, $user)
193
+            ?: redirect ($this->redirectPath ());
194 194
     }
195 195
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/ForgotPasswordController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function __construct()
30 30
     {
31
-        $this->middleware('guest');
31
+        $this->middleware ('guest');
32 32
     }
33 33
 
34 34
     /**
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function showLinkRequestForm()
42 42
     {
43
-        return view('auth.passwords.email', [
44
-            'routes' => $this->auth_routes(),
45
-            'forgot_password' => Lang::get('common/auth/forgot_password'),
43
+        return view ('auth.passwords.email', [
44
+            'routes' => $this->auth_routes (),
45
+            'forgot_password' => Lang::get ('common/auth/forgot_password'),
46 46
         ]);
47 47
     }
48 48
 }
Please login to merge, or discard this patch.
app/Http/Controllers/RatingGuideAnswerController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
     {
20 20
         // Authorization handled by the FormRequest.
21 21
         // Data validation handled by this line.
22
-        $data = $request->validated();
23
-        $ratingGuideAnswer = new RatingGuideAnswer($data);
24
-        $ratingGuideAnswer->save();
22
+        $data = $request->validated ();
23
+        $ratingGuideAnswer = new RatingGuideAnswer ($data);
24
+        $ratingGuideAnswer->save ();
25 25
 
26 26
         return [
27 27
             'success' => "Successfully created rating guide answer $ratingGuideAnswer->id",
28
-            'rating_guide_answer' => $ratingGuideAnswer->toArray(),
28
+            'rating_guide_answer' => $ratingGuideAnswer->toArray (),
29 29
         ];
30 30
     }
31 31
 
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function show(RatingGuideAnswer $ratingGuideAnswer)
39 39
     {
40
-        $this->authorize('view', $ratingGuideAnswer);
41
-        return $ratingGuideAnswer->toArray();
40
+        $this->authorize ('view', $ratingGuideAnswer);
41
+        return $ratingGuideAnswer->toArray ();
42 42
     }
43 43
 
44 44
     /**
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
     {
54 54
         // Authorization handled by the FormRequest.
55 55
         // Data validation handled by this line.
56
-        $data = $request->validated();
56
+        $data = $request->validated ();
57 57
 
58
-        $ratingGuideAnswer->fill($data);
59
-        $ratingGuideAnswer->save();
60
-        $ratingGuideAnswer->refresh();
58
+        $ratingGuideAnswer->fill ($data);
59
+        $ratingGuideAnswer->save ();
60
+        $ratingGuideAnswer->refresh ();
61 61
         return [
62 62
             'success' => "Successfully updated rating guide answer $ratingGuideAnswer->id",
63
-            'rating_guide_answer' => $ratingGuideAnswer->toArray(),
63
+            'rating_guide_answer' => $ratingGuideAnswer->toArray (),
64 64
         ];
65 65
     }
66 66
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function destroy(RatingGuideAnswer $ratingGuideAnswer)
74 74
     {
75
-        $this->authorize('delete', $ratingGuideAnswer);
76
-        $ratingGuideAnswer->delete();
75
+        $this->authorize ('delete', $ratingGuideAnswer);
76
+        $ratingGuideAnswer->delete ();
77 77
 
78 78
         return [
79 79
             'success' => "Successfully deleted rating guide answer $ratingGuideAnswer->id"
Please login to merge, or discard this patch.
app/Http/Controllers/WorkSamplesController.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
      */
20 20
     public function editAuthenticated(Request $request)
21 21
     {
22
-        $applicant = $request->user()->applicant;
23
-        return redirect(route('profile.work_samples.edit', $applicant));
22
+        $applicant = $request->user ()->applicant;
23
+        return redirect (route ('profile.work_samples.edit', $applicant));
24 24
     }
25 25
 
26 26
     /**
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function edit(Request $request, Applicant $applicant)
34 34
     {
35
-        $applicant->load([
35
+        $applicant->load ([
36 36
             'work_samples',
37 37
             'skill_declarations.skill',
38 38
         ]);
39 39
 
40
-        return view('applicant/profile_05_portfolio', [
40
+        return view ('applicant/profile_05_portfolio', [
41 41
             'applicant' => $applicant,
42
-            'profile' => Lang::get('applicant/profile_work_samples'),
42
+            'profile' => Lang::get ('applicant/profile_work_samples'),
43 43
         ]);
44 44
     }
45 45
 
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function update(Request $request, ?WorkSample $workSample = null)
54 54
     {
55
-        $validator = new UpdateWorkSampleValidator();
56
-        $validator->validate($request->input());
55
+        $validator = new UpdateWorkSampleValidator ();
56
+        $validator->validate ($request->input ());
57 57
 
58 58
         if ($workSample === null) {
59
-            $workSample = new WorkSample();
60
-            $workSample->applicant_id = $request->user()->applicant->id;
59
+            $workSample = new WorkSample ();
60
+            $workSample->applicant_id = $request->user ()->applicant->id;
61 61
         }
62
-        $workSample->fill([
63
-            'name' => $request->input('name'),
64
-            'file_type_id' => $request->input('file_type_id'),
65
-            'url' => $request->input('url'),
66
-            'description' => $request->input('description'),
62
+        $workSample->fill ([
63
+            'name' => $request->input ('name'),
64
+            'file_type_id' => $request->input ('file_type_id'),
65
+            'url' => $request->input ('url'),
66
+            'description' => $request->input ('description'),
67 67
         ]);
68
-        $workSample->save();
68
+        $workSample->save ();
69 69
 
70 70
         // Attach relatives.
71
-        $skillIds = $this->getRelativeIds($request->input(), 'skills');
72
-        $workSample->skill_declarations()->sync($skillIds);
71
+        $skillIds = $this->getRelativeIds ($request->input (), 'skills');
72
+        $workSample->skill_declarations ()->sync ($skillIds);
73 73
 
74 74
         // If an ajax request, return the new object.
75
-        if ($request->ajax()) {
76
-            $workSample->load('file_type');
77
-            return $workSample->toJson();
75
+        if ($request->ajax ()) {
76
+            $workSample->load ('file_type');
77
+            return $workSample->toJson ();
78 78
         } else {
79
-            return redirect()->back();
79
+            return redirect ()->back ();
80 80
         }
81 81
     }
82 82
 
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function destroy(Request $request, WorkSample $workSample)
91 91
     {
92
-        $this->authorize('delete', $workSample);
92
+        $this->authorize ('delete', $workSample);
93 93
 
94
-        $workSample->delete();
94
+        $workSample->delete ();
95 95
 
96
-        if ($request->ajax()) {
96
+        if ($request->ajax ()) {
97 97
             return [
98 98
                 'message' => 'Work sample deleted'
99 99
             ];
100 100
         }
101 101
 
102
-        return redirect()->back();
102
+        return redirect ()->back ();
103 103
     }
104 104
 }
Please login to merge, or discard this patch.
app/Console/Kernel.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
         //          ->hourly();
29 29
 
30 30
         // start the queue daemon, if its not running
31
-        if (!$this->osProcessIsRunning('queue:work')) {
32
-            $schedule->command('queue:work')->everyMinute();
31
+        if (!$this->osProcessIsRunning ('queue:work')) {
32
+            $schedule->command ('queue:work')->everyMinute ();
33 33
         }
34 34
     }
35 35
 
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
      */
41 41
     protected function commands(): void
42 42
     {
43
-        $this->load(__DIR__.'/Commands');
43
+        $this->load (__DIR__.'/Commands');
44 44
 
45
-        require base_path('routes/console.php');
45
+        require base_path ('routes/console.php');
46 46
     }
47 47
 
48 48
     /**
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
     protected function osProcessIsRunning(string $needle): bool
55 55
     {
56 56
         // get process status. the "-ww"-option is important to get the full output!
57
-        exec('ps aux -ww', $process_status);
57
+        exec ('ps aux -ww', $process_status);
58 58
 
59 59
 
60 60
         // search $needle in process status
61
-        $result = array_filter(
61
+        $result = array_filter (
62 62
             $process_status,
63 63
             function ($var) use ($needle) {
64
-                return strpos($var, $needle);
64
+                return strpos ($var, $needle);
65 65
             }
66 66
         );
67 67
 
Please login to merge, or discard this patch.
app/Services/WhichPortal.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,34 +10,34 @@
 block discarded – undo
10 10
 
11 11
     public function isApplicantPortal()
12 12
     {
13
-        return !$this->isManagerPortal() && !$this->isAdminPortal();
13
+        return !$this->isManagerPortal () && !$this->isAdminPortal ();
14 14
     }
15 15
 
16 16
     public function isManagerPortal()
17 17
     {
18
-        $url = URL::current();
19
-        return $this->urlIsManagerPortal($url);
18
+        $url = URL::current ();
19
+        return $this->urlIsManagerPortal ($url);
20 20
     }
21 21
 
22 22
     public function isAdminPortal()
23 23
     {
24
-        $url = URL::current();
25
-        return $this->urlIsAdminPortal($url);
24
+        $url = URL::current ();
25
+        return $this->urlIsAdminPortal ($url);
26 26
     }
27 27
 
28 28
     public function urlIsManagerPortal($url): bool
29 29
     {
30
-        $baseUrl = config('app.url');
31
-        $managerPrefix = config('app.manager_prefix');
30
+        $baseUrl = config ('app.url');
31
+        $managerPrefix = config ('app.manager_prefix');
32 32
         $managerPattern = "#^$baseUrl/(\w+/)?$managerPrefix(/.*)?$#";
33
-        return preg_match($managerPattern, $url);
33
+        return preg_match ($managerPattern, $url);
34 34
     }
35 35
 
36 36
     public function urlIsAdminPortal($url): bool
37 37
     {
38
-        $baseUrl = config('app.url');
39
-        $adminPrefix = config('backpack.base.route_prefix', 'admin');
38
+        $baseUrl = config ('app.url');
39
+        $adminPrefix = config ('backpack.base.route_prefix', 'admin');
40 40
         $adminPattern = "#^$baseUrl/(\w+/)?$adminPrefix(/.*)?$#";
41
-        return preg_match($adminPattern, $url);
41
+        return preg_match ($adminPattern, $url);
42 42
     }
43 43
 }
Please login to merge, or discard this patch.
app/Services/Validation/RegistrationValidator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public static function userValidator(array $data)
40 40
     {
41
-        return Validator::make($data, self::basicRules());
41
+        return Validator::make ($data, self::basicRules ());
42 42
     }
43 43
 
44 44
     /**
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public static function managerValidator(array $data)
51 51
     {
52
-        $managerRules = array_merge(self::basicRules(), self::managerRegistrationExtraRules());
53
-        return Validator::make($data, $managerRules);
52
+        $managerRules = array_merge (self::basicRules (), self::managerRegistrationExtraRules ());
53
+        return Validator::make ($data, $managerRules);
54 54
     }
55 55
 
56 56
     /**
@@ -61,6 +61,6 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public static function finalizeManagerValidator(array $data)
63 63
     {
64
-        return Validator::make($data, self::managerRegistrationExtraRules());
64
+        return Validator::make ($data, self::managerRegistrationExtraRules ());
65 65
     }
66 66
 }
Please login to merge, or discard this patch.
app/Services/Validation/Rules/PasswordCorrectRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@
 block discarded – undo
11 11
 {
12 12
     public function passes($attribute, $value)
13 13
     {
14
-        return Hash::check($value, Auth::user()->getAuthPassword());
14
+        return Hash::check ($value, Auth::user ()->getAuthPassword ());
15 15
     }
16 16
 
17 17
     public function message()
18 18
     {
19
-        return Lang::get('validation.password_correct');
19
+        return Lang::get ('validation.password_correct');
20 20
     }
21 21
 }
Please login to merge, or discard this patch.