Passed
Push — npm/audit-fix ( 9e66ec )
by Yonathan
29:50 queued 14:40
created
app/Http/Controllers/Auth/AuthController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,27 +12,27 @@
 block discarded – undo
12 12
      *
13 13
      * @return mixed[]
14 14
      */
15
-    protected function auth_routes()
15
+    protected function auth_routes ()
16 16
     {
17
-        if (WhichPortal::isManagerPortal()) {
17
+        if (WhichPortal::isManagerPortal ()) {
18 18
             $routes = [
19
-                'home' => route('manager.home'),
20
-                'login' => route('manager.login'),
21
-                'register' => route('manager.register'),
19
+                'home' => route ('manager.home'),
20
+                'login' => route ('manager.login'),
21
+                'register' => route ('manager.register'),
22 22
                 'password' => [
23
-                    'email' => route('manager.password.email'),
24
-                    'request' => route('manager.password.request'),
23
+                    'email' => route ('manager.password.email'),
24
+                    'request' => route ('manager.password.request'),
25 25
                 ],
26 26
                 // 'passwords.reset' => route('manager.password.reset'),
27 27
             ];
28 28
         } else {
29 29
             $routes = [
30
-                'home' => route('home'),
31
-                'login' => route('login'),
32
-                'register' => route('register'),
30
+                'home' => route ('home'),
31
+                'login' => route ('login'),
32
+                'register' => route ('register'),
33 33
                 'password' => [
34
-                    'email' => route('password.email'),
35
-                    'request' => route('password.request'),
34
+                    'email' => route ('password.email'),
35
+                    'request' => route ('password.request'),
36 36
                 ],
37 37
                 // 'passwords.reset' => route('password.reset'),
38 38
             ];
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/FirstVisitController.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
      * @param Request $request
18 18
      * @return \Illuminate\Http\Response
19 19
      */
20
-    public function showFirstVisitManagerForm()
20
+    public function showFirstVisitManagerForm ()
21 21
     {
22 22
         $routes = [
23
-            'return' => route('home'),
24
-            'continue' => route('manager.finish_registration'),
23
+            'return' => route ('home'),
24
+            'continue' => route ('manager.finish_registration'),
25 25
         ];
26 26
 
27
-        return view('auth.first_visit_manager', [
27
+        return view ('auth.first_visit_manager', [
28 28
             'routes' => $routes,
29
-            'first_visit' => Lang::get('common/auth/first_manager_visit'),
30
-            'departments' => Department::all(),
31
-            'not_in_gov_option' => ['value' => 0, 'name' => Lang::get('common/auth/register.not_in_gov')],
29
+            'first_visit' => Lang::get ('common/auth/first_manager_visit'),
30
+            'departments' => Department::all (),
31
+            'not_in_gov_option' => ['value' => 0, 'name' => Lang::get ('common/auth/register.not_in_gov')],
32 32
         ]);
33 33
     }
34 34
 
@@ -38,36 +38,36 @@  discard block
 block discarded – undo
38 38
      * @param Request $request
39 39
      * @return void
40 40
      */
41
-    public function finishManagerRegistration(Request $request)
41
+    public function finishManagerRegistration (Request $request)
42 42
     {
43
-        $data = $request->all();
44
-        $validator = RegistrationValidator::finalizeManagerValidator($data);
45
-        $validator->validate();
43
+        $data = $request->all ();
44
+        $validator = RegistrationValidator::finalizeManagerValidator ($data);
45
+        $validator->validate ();
46 46
 
47
-        $user = $request->user();
47
+        $user = $request->user ();
48 48
 
49 49
         // Save manager specific fields to user
50
-        $managerDepartment = Department::find($data['department']);
50
+        $managerDepartment = Department::find ($data['department']);
51 51
         $inGovernment = ($managerDepartment !== null);
52 52
         $user->not_in_gov = !$inGovernment;
53 53
         $user->gov_email = $inGovernment ? $data['gov_email'] : null;
54
-        $user->save();
55
-        $user->refresh();
54
+        $user->save ();
55
+        $user->refresh ();
56 56
 
57 57
         // Add (or update) manager profile
58 58
         // NOTE: modifying a field in $user, and saving it, appears to create Manager object. I don't know how. -- Tristan
59 59
         // That means that after setting not_in_gov or gov_email, a manager already exists here. Adding a new one will throw an exception.
60 60
         $department_id = $inGovernment ? $managerDepartment->id : null;
61 61
         if ($user->manager === null) {
62
-            $user->applicant()->save(new Manager());
63
-            $user->refresh();
62
+            $user->applicant ()->save (new Manager ());
63
+            $user->refresh ();
64 64
         }
65 65
         $user->manager->department_id = $department_id;
66
-        $user->manager->save();
66
+        $user->manager->save ();
67 67
 
68
-        $user->refresh();
69
-        $expectedUrl = session()->remove('url.expected');
70
-        session()->remove('url.expected');
71
-        return redirect($expectedUrl);
68
+        $user->refresh ();
69
+        $expectedUrl = session ()->remove ('url.expected');
70
+        session ()->remove ('url.expected');
71
+        return redirect ($expectedUrl);
72 72
     }
73 73
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/RegisterController.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
      *
36 36
      * @return string
37 37
      */
38
-    protected function redirectTo()
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
 
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
      *
47 47
      * @return void
48 48
      */
49
-    public function __construct()
49
+    public function __construct ()
50 50
     {
51
-        $this->middleware('guest');
51
+        $this->middleware ('guest');
52 52
     }
53 53
 
54 54
     /**
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
      *
57 57
      * @return \Illuminate\Http\Response
58 58
      */
59
-    public function showRegistrationForm()
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
 
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
      *
71 71
      * @return \Illuminate\Http\Response
72 72
      */
73
-    public function showManagerRegistrationForm()
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
 
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
      * @param  array $data Incoming registration data.
89 89
      * @return \Illuminate\Contracts\Validation\Validator
90 90
      */
91
-    protected function validator(array $data)
91
+    protected function validator (array $data)
92 92
     {
93
-        return RegistrationValidator::userValidator($data);
93
+        return RegistrationValidator::userValidator ($data);
94 94
     }
95 95
 
96 96
     /**
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
      * @param  array $data Incoming registration data.
100 100
      * @return \Illuminate\Contracts\Validation\Validator
101 101
      */
102
-    protected function managerValidator(array $data)
102
+    protected function managerValidator (array $data)
103 103
     {
104
-        return RegistrationValidator::managerValidator($data);
104
+        return RegistrationValidator::managerValidator ($data);
105 105
     }
106 106
 
107 107
     /**
@@ -110,22 +110,22 @@  discard block
 block discarded – undo
110 110
      * @param  array $data Incoming User data.
111 111
      * @return \App\Models\User
112 112
      */
113
-    protected function create(array $data)
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
     /**
@@ -134,31 +134,31 @@  discard block
 block discarded – undo
134 134
      * @param  array $data Incoming User data.
135 135
      * @return \App\Models\User
136 136
      */
137
-    protected function createManager(array $data)
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
     /**
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
      * @param  mixed                    $user    Incoming User data.
170 170
      * @return \Illuminate\Http\Response
171 171
      */
172
-    protected function registered(Request $request, $user)
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
     /**
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
      * @param  \Illuminate\Http\Request  $request
182 182
      * @return \Illuminate\Http\Response
183 183
      */
184
-    public function registerManager(Request $request)
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/LoginController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
      *
43 43
      * @return string
44 44
      */
45
-    protected function redirectTo()
45
+    protected function redirectTo ()
46 46
     {
47
-        $redirectTo = WhichPortal::isManagerPortal() ? route('manager.home') : route('home');
47
+        $redirectTo = WhichPortal::isManagerPortal () ? route('manager.home') : route ('home');
48 48
         return $redirectTo;
49 49
     }
50 50
 
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
      *
54 54
      * @return void
55 55
      */
56
-    public function __construct()
56
+    public function __construct ()
57 57
     {
58
-        $this->middleware('guest')->except('logout');
58
+        $this->middleware ('guest')->except ('logout');
59 59
     }
60 60
 
61 61
     /**
@@ -64,13 +64,13 @@  discard block
 block discarded – undo
64 64
      *
65 65
      * @return \Illuminate\Http\Response
66 66
      */
67
-    public function showLoginForm()
67
+    public function showLoginForm ()
68 68
     {
69
-        $home_url = WhichPortal::isManagerPortal() ? route('manager.home') : route('home');
69
+        $home_url = WhichPortal::isManagerPortal () ? route('manager.home') : route ('home');
70 70
 
71
-        return view('auth/login', [
72
-            'routes' => $this->auth_routes(),
73
-            'login' => Lang::get('common/auth/login'),
71
+        return view ('auth/login', [
72
+            'routes' => $this->auth_routes (),
73
+            'login' => Lang::get ('common/auth/login'),
74 74
             'home_url' => $home_url,
75 75
         ]);
76 76
     }
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
      * @param  \Illuminate\Http\Request $request Incoming Request object.
83 83
      * @return \Illuminate\Http\Response
84 84
      */
85
-    public function logout(Request $request)
85
+    public function logout (Request $request)
86 86
     {
87
-        $this->guard()->logout();
87
+        $this->guard ()->logout ();
88 88
 
89
-        $request->session()->invalidate();
89
+        $request->session ()->invalidate ();
90 90
 
91 91
         // This causes logout to redirect to the same page as login.
92
-        return redirect($this->redirectPath());
92
+        return redirect ($this->redirectPath ());
93 93
     }
94 94
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/ResetPasswordController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
      *
30 30
      * @return string
31 31
      */
32
-    protected function redirectTo()
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
 
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
      *
41 41
      * @return void
42 42
      */
43
-    public function __construct()
43
+    public function __construct ()
44 44
     {
45
-        $this->middleware('guest');
45
+        $this->middleware ('guest');
46 46
     }
47 47
 
48 48
     /**
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
      * @param  string|null              $token   Validation token.
55 55
      * @return \Illuminate\Http\Response
56 56
      */
57
-    public function showResetForm(Request $request, $token = null)
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
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      *
71 71
      * @return array
72 72
      */
73
-    protected function rules()
73
+    protected function rules ()
74 74
     {
75 75
         return [
76 76
             'token' => 'required',
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return array
92 92
      */
93
-    protected function validationErrorMessages()
93
+    protected function validationErrorMessages ()
94 94
     {
95 95
         return [];
96 96
     }
Please login to merge, or discard this patch.
app/Http/Controllers/RatingGuideAnswerController.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -15,17 +15,17 @@  discard block
 block discarded – undo
15 15
      * @throws \InvalidArgumentException For missing $expected_answer.
16 16
      * @return mixed
17 17
      */
18
-    public function store(StoreRatingGuideAnswer $request)
18
+    public function store (StoreRatingGuideAnswer $request)
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
 
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
      * @param  \App\Models\RatingGuideAnswer $ratingGuideAnswer Incoming object.
36 36
      * @return mixed
37 37
      */
38
-    public function show(RatingGuideAnswer $ratingGuideAnswer)
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
     /**
@@ -49,18 +49,18 @@  discard block
 block discarded – undo
49 49
      * @throws \InvalidArgumentException For empty $expected_answer.
50 50
      * @return mixed
51 51
      */
52
-    public function update(UpdateRatingGuideAnswer $request, RatingGuideAnswer $ratingGuideAnswer)
52
+    public function update (UpdateRatingGuideAnswer $request, RatingGuideAnswer $ratingGuideAnswer)
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
 
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
      * @param  \App\Models\RatingGuideAnswer $ratingGuideAnswer Incoming object.
71 71
      * @return mixed
72 72
      */
73
-    public function destroy(RatingGuideAnswer $ratingGuideAnswer)
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/JobController.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -21,28 +21,28 @@  discard block
 block discarded – undo
21 21
      *
22 22
      * @return \Illuminate\Http\Response
23 23
      */
24
-    public function index()
24
+    public function index ()
25 25
     {
26
-        $now = Carbon::now();
26
+        $now = Carbon::now ();
27 27
 
28 28
         // Find published jobs that are currently open for applications.
29 29
         // Eager load required relationships: Department, Province, JobTerm.
30 30
         // Eager load the count of submitted applications, to prevent the relationship
31 31
         // from being actually loaded and firing off events.
32
-        $jobs = JobPoster::where('open_date_time', '<=', $now)
33
-            ->where('close_date_time', '>=', $now)
34
-            ->where('published', true)
35
-            ->with([
32
+        $jobs = JobPoster::where ('open_date_time', '<=', $now)
33
+            ->where ('close_date_time', '>=', $now)
34
+            ->where ('published', true)
35
+            ->with ([
36 36
                 'department',
37 37
                 'province',
38 38
                 'job_term',
39 39
             ])
40
-            ->withCount([
40
+            ->withCount ([
41 41
                 'submitted_applications',
42 42
             ])
43
-            ->get();
44
-        return view('applicant/job_index', [
45
-            'job_index' => Lang::get('applicant/job_index'),
43
+            ->get ();
44
+        return view ('applicant/job_index', [
45
+            'job_index' => Lang::get ('applicant/job_index'),
46 46
             'jobs' => $jobs
47 47
         ]);
48 48
     }
@@ -52,33 +52,33 @@  discard block
 block discarded – undo
52 52
      *
53 53
      * @return \Illuminate\Http\Response
54 54
      */
55
-    public function managerIndex()
55
+    public function managerIndex ()
56 56
     {
57
-        $manager = Auth::user()->manager;
57
+        $manager = Auth::user ()->manager;
58 58
 
59
-        $jobs = JobPoster::where('manager_id', $manager->id)
60
-            ->with('classification')
61
-            ->withCount('submitted_applications')
62
-            ->get();
59
+        $jobs = JobPoster::where ('manager_id', $manager->id)
60
+            ->with ('classification')
61
+            ->withCount ('submitted_applications')
62
+            ->get ();
63 63
 
64 64
         foreach ($jobs as &$job) {
65 65
             $chosen_lang = $job->chosen_lang;
66 66
 
67 67
             // Show chosen lang title if current title is empty.
68 68
             if (empty($job->title)) {
69
-                $job->title = $job->translate($chosen_lang)->title;
69
+                $job->title = $job->translate ($chosen_lang)->title;
70 70
                 $job->trans_required = true;
71 71
             }
72 72
 
73 73
             // Always preview and edit in the chosen language.
74
-            $job->preview_link = LaravelLocalization::getLocalizedURL($chosen_lang, route('manager.jobs.show', $job));
75
-            $job->edit_link = LaravelLocalization::getLocalizedURL($chosen_lang, route('manager.jobs.edit', $job));
74
+            $job->preview_link = LaravelLocalization::getLocalizedURL ($chosen_lang, route ('manager.jobs.show', $job));
75
+            $job->edit_link = LaravelLocalization::getLocalizedURL ($chosen_lang, route ('manager.jobs.edit', $job));
76 76
         }
77 77
 
78 78
 
79
-        return view('manager/job_index', [
79
+        return view ('manager/job_index', [
80 80
             // Localization Strings.
81
-            'jobs_l10n' => Lang::get('manager/job_index'),
81
+            'jobs_l10n' => Lang::get ('manager/job_index'),
82 82
             // Data.
83 83
             'jobs' => $jobs,
84 84
         ]);
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
      * @param  \App\Models\JobPoster    $jobPoster Job Poster object.
92 92
      * @return \Illuminate\Http\Response
93 93
      */
94
-    public function destroy(Request $request, JobPoster $jobPoster)
94
+    public function destroy (Request $request, JobPoster $jobPoster)
95 95
     {
96
-        $jobPoster->delete();
96
+        $jobPoster->delete ();
97 97
     }
98 98
 
99 99
     /**
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
      * @param  \App\Models\JobPoster    $jobPoster Job Poster object.
104 104
      * @return \Illuminate\Http\Response
105 105
      */
106
-    public function show(Request $request, JobPoster $jobPoster)
106
+    public function show (Request $request, JobPoster $jobPoster)
107 107
     {
108
-        $jobPoster->load([
108
+        $jobPoster->load ([
109 109
             'department',
110 110
             'criteria.skill.skill_type',
111 111
             'manager.team_culture',
112 112
             'manager.work_environment'
113 113
         ]);
114 114
 
115
-        $user = Auth::user();
115
+        $user = Auth::user ();
116 116
 
117 117
         // TODO: Improve workplace photos, and reference them in template direction from WorkEnvironment model.
118 118
         $workplacePhotos = [];
@@ -125,36 +125,36 @@  discard block
 block discarded – undo
125 125
 
126 126
         // TODO: replace route('manager.show',manager.id) in templates with link using slug.
127 127
         $criteria = [
128
-            'essential' => $jobPoster->criteria->filter(
128
+            'essential' => $jobPoster->criteria->filter (
129 129
                 function ($value, $key) {
130 130
                     return $value->criteria_type->name == 'essential';
131 131
                 }
132 132
             ),
133
-            'asset' => $jobPoster->criteria->filter(
133
+            'asset' => $jobPoster->criteria->filter (
134 134
                 function ($value, $key) {
135 135
                     return $value->criteria_type->name == 'asset';
136 136
                 }
137 137
             ),
138 138
         ];
139 139
 
140
-        $jobLang = Lang::get('applicant/job_post');
140
+        $jobLang = Lang::get ('applicant/job_post');
141 141
 
142 142
         $applyButton = [];
143
-        if (!$jobPoster->published && $this->authorize('update', $jobPoster)) {
143
+        if (!$jobPoster->published && $this->authorize ('update', $jobPoster)) {
144 144
             $applyButton = [
145
-                'href' => route('manager.jobs.edit', $jobPoster->id),
145
+                'href' => route ('manager.jobs.edit', $jobPoster->id),
146 146
                 'title' => $jobLang['apply']['edit_link_title'],
147 147
                 'text' => $jobLang['apply']['edit_link_label'],
148 148
             ];
149
-        } elseif (Auth::check() && $jobPoster->isOpen()) {
149
+        } elseif (Auth::check () && $jobPoster->isOpen ()) {
150 150
             $applyButton = [
151
-                'href' => route('job.application.edit.1', $jobPoster->id),
151
+                'href' => route ('job.application.edit.1', $jobPoster->id),
152 152
                 'title' => $jobLang['apply']['apply_link_title'],
153 153
                 'text' => $jobLang['apply']['apply_link_label'],
154 154
             ];
155
-        } elseif (Auth::guest() && $jobPoster->isOpen()) {
155
+        } elseif (Auth::guest () && $jobPoster->isOpen ()) {
156 156
             $applyButton = [
157
-                'href' => route('job.application.edit.1', $jobPoster->id),
157
+                'href' => route ('job.application.edit.1', $jobPoster->id),
158 158
                 'title' => $jobLang['apply']['login_link_title'],
159 159
                 'text' => $jobLang['apply']['login_link_label'],
160 160
             ];
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
             ];
167 167
         }
168 168
 
169
-        $jpb_release_date = strtotime('2019-08-21 16:18:17');
170
-        $job_created_at = strtotime($jobPoster->created_at);
169
+        $jpb_release_date = strtotime ('2019-08-21 16:18:17');
170
+        $job_created_at = strtotime ($jobPoster->created_at);
171 171
 
172 172
         // If the job poster is created after the release of the JPB.
173 173
         // Then, render with updated poster template.
174 174
         // Else, render with old poster template.
175 175
         if ($job_created_at > $jpb_release_date) {
176 176
             // Updated job poster (JPB).
177
-            return view(
177
+            return view (
178 178
                 'applicant/jpb_job_post',
179 179
                 [
180 180
                     'job_post' => $jobLang,
181
-                    'skill_template' => Lang::get('common/skills'),
181
+                    'skill_template' => Lang::get ('common/skills'),
182 182
                     'job' => $jobPoster,
183 183
                     'manager' => $jobPoster->manager,
184 184
                     'criteria' => $criteria,
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             );
188 188
         } else {
189 189
             // Old job poster.
190
-            return view(
190
+            return view (
191 191
                 'applicant/job_post',
192 192
                 [
193 193
                     'job_post' => $jobLang,
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                     'job' => $jobPoster,
200 200
                     'criteria' => $criteria,
201 201
                     'apply_button' => $applyButton,
202
-                    'skill_template' => Lang::get('common/skills'),
202
+                    'skill_template' => Lang::get ('common/skills'),
203 203
                 ]
204 204
             );
205 205
         }
@@ -213,24 +213,24 @@  discard block
 block discarded – undo
213 213
      * @param  \App\Models\JobPoster    $jobPoster Job Poster object.
214 214
      * @return \Illuminate\Http\Response
215 215
      */
216
-    public function edit(Request $request, JobPoster $jobPoster)
216
+    public function edit (Request $request, JobPoster $jobPoster)
217 217
     {
218 218
         $manager = $jobPoster->manager;
219 219
 
220
-        if ($jobPoster->job_poster_questions === null || $jobPoster->job_poster_questions->count() === 0) {
221
-            $jobPoster->job_poster_questions()->saveMany($this->populateDefaultQuestions());
222
-            $jobPoster->refresh();
220
+        if ($jobPoster->job_poster_questions === null || $jobPoster->job_poster_questions->count () === 0) {
221
+            $jobPoster->job_poster_questions ()->saveMany ($this->populateDefaultQuestions ());
222
+            $jobPoster->refresh ();
223 223
         }
224 224
 
225
-        return view(
225
+        return view (
226 226
             'manager/job_create',
227 227
             [
228 228
                 // Localization Strings.
229
-                'job_l10n' => Lang::get('manager/job_edit'),
229
+                'job_l10n' => Lang::get ('manager/job_edit'),
230 230
                 // Data.
231 231
                 'manager' => $manager,
232 232
                 'job' => $jobPoster,
233
-                'form_action_url' => route('admin.jobs.update', $jobPoster),
233
+                'form_action_url' => route ('admin.jobs.update', $jobPoster),
234 234
             ]
235 235
         );
236 236
     }
@@ -241,23 +241,23 @@  discard block
 block discarded – undo
241 241
      * @param  \App\Models\Manager $manager Incoming Manager object.
242 242
      * @return \Illuminate\Http\Response Job Create view
243 243
      */
244
-    public function createAsManager(Manager $manager)
244
+    public function createAsManager (Manager $manager)
245 245
     {
246
-        $jobPoster = new JobPoster();
246
+        $jobPoster = new JobPoster ();
247 247
         $jobPoster->manager_id = $manager->id;
248 248
 
249 249
         // Save manager-specific info to the job poster - equivalent to the intro step of the JPB
250
-        $divisionEn = $manager->translate('en') !== null ? $manager->translate('en')->division : null;
251
-        $divisionFr = $manager->translate('fr') !== null ? $manager->translate('fr')->division : null;
252
-        $jobPoster->fill([
250
+        $divisionEn = $manager->translate ('en') !== null ? $manager->translate ('en')->division : null;
251
+        $divisionFr = $manager->translate ('fr') !== null ? $manager->translate ('fr')->division : null;
252
+        $jobPoster->fill ([
253 253
             'department_id' => $manager->department_id,
254 254
             'en' => ['division' => $divisionEn],
255 255
             'fr' => ['division' => $divisionFr],
256 256
         ]);
257 257
 
258
-        $jobPoster->save();
258
+        $jobPoster->save ();
259 259
 
260
-        return redirect()->route('manager.jobs.edit', $jobPoster->id);
260
+        return redirect ()->route ('manager.jobs.edit', $jobPoster->id);
261 261
     }
262 262
 
263 263
     /**
@@ -268,23 +268,23 @@  discard block
 block discarded – undo
268 268
      * @param  \App\Models\JobPoster    $jobPoster Optional Job Poster object.
269 269
      * @return \Illuminate\Http\Response
270 270
      */
271
-    public function store(Request $request, JobPoster $jobPoster)
271
+    public function store (Request $request, JobPoster $jobPoster)
272 272
     {
273 273
         // Don't allow edits for published Job Posters
274 274
         // Also check auth while we're at it.
275
-        $this->authorize('update', $jobPoster);
276
-        JobPosterValidator::validateUnpublished($jobPoster);
275
+        $this->authorize ('update', $jobPoster);
276
+        JobPosterValidator::validateUnpublished ($jobPoster);
277 277
 
278
-        $input = $request->input();
278
+        $input = $request->input ();
279 279
 
280 280
         if ($jobPoster->manager_id == null) {
281
-            $jobPoster->manager_id = $request->user()->manager->id;
282
-            $jobPoster->save();
281
+            $jobPoster->manager_id = $request->user ()->manager->id;
282
+            $jobPoster->save ();
283 283
         }
284 284
 
285
-        $this->fillAndSaveJobPosterQuestions($input, $jobPoster, true);
285
+        $this->fillAndSaveJobPosterQuestions ($input, $jobPoster, true);
286 286
 
287
-        return redirect(route('manager.jobs.show', $jobPoster->id));
287
+        return redirect (route ('manager.jobs.show', $jobPoster->id));
288 288
     }
289 289
 
290 290
     /**
@@ -295,20 +295,20 @@  discard block
 block discarded – undo
295 295
      * @param  boolean               $replace   Remove existing relationships.
296 296
      * @return void
297 297
      */
298
-    protected function fillAndSaveJobPosterQuestions(array $input, JobPoster $jobPoster, bool $replace) : void
298
+    protected function fillAndSaveJobPosterQuestions (array $input, JobPoster $jobPoster, bool $replace) : void
299 299
     {
300 300
         if ($replace) {
301
-            $jobPoster->job_poster_questions()->delete();
301
+            $jobPoster->job_poster_questions ()->delete ();
302 302
         }
303 303
 
304
-        if (!array_key_exists('question', $input) || !is_array($input['question'])) {
304
+        if (!array_key_exists ('question', $input) || !is_array ($input['question'])) {
305 305
             return;
306 306
         }
307 307
 
308 308
         foreach ($input['question'] as $question) {
309
-            $jobQuestion = new JobPosterQuestion();
309
+            $jobQuestion = new JobPosterQuestion ();
310 310
             $jobQuestion->job_poster_id = $jobPoster->id;
311
-            $jobQuestion->fill(
311
+            $jobQuestion->fill (
312 312
                 [
313 313
                     'en' => [
314 314
                         'question' => $question['question']['en'],
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
                     ]
321 321
                 ]
322 322
             );
323
-            $jobPoster->save();
324
-            $jobQuestion->save();
323
+            $jobPoster->save ();
324
+            $jobQuestion->save ();
325 325
         }
326 326
     }
327 327
 
@@ -330,23 +330,23 @@  discard block
 block discarded – undo
330 330
      *
331 331
      * @return mixed[]|void
332 332
      */
333
-    protected function populateDefaultQuestions()
333
+    protected function populateDefaultQuestions ()
334 334
     {
335 335
         $defaultQuestions = [
336
-            'en' => array_values(Lang::get('manager/job_create', [], 'en')['questions']),
337
-            'fr' => array_values(Lang::get('manager/job_create', [], 'fr')['questions']),
336
+            'en' => array_values (Lang::get ('manager/job_create', [], 'en')['questions']),
337
+            'fr' => array_values (Lang::get ('manager/job_create', [], 'fr')['questions']),
338 338
         ];
339 339
 
340
-        if (count($defaultQuestions['en']) !== count($defaultQuestions['fr'])) {
341
-            Log::warning('There must be the same number of French and English default questions for a Job Poster.');
340
+        if (count ($defaultQuestions['en']) !== count ($defaultQuestions['fr'])) {
341
+            Log::warning ('There must be the same number of French and English default questions for a Job Poster.');
342 342
             return;
343 343
         }
344 344
 
345 345
         $jobQuestions = [];
346 346
 
347
-        for ($i = 0; $i < count($defaultQuestions['en']); $i++) {
348
-            $jobQuestion = new JobPosterQuestion();
349
-            $jobQuestion->fill(
347
+        for ($i = 0; $i < count ($defaultQuestions['en']); $i++) {
348
+            $jobQuestion = new JobPosterQuestion ();
349
+            $jobQuestion->fill (
350 350
                 [
351 351
                     'en' => [
352 352
                         'question' => $defaultQuestions['en'][$i],
Please login to merge, or discard this patch.
app/Http/Controllers/ApplicantProfileController.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      * @param  \App\Models\Applicant    $applicant Incoming Applicant object.
28 28
      * @return \Illuminate\Http\Response
29 29
      */
30
-    public function show(Request $request, Applicant $applicant)
30
+    public function show (Request $request, Applicant $applicant)
31 31
     {
32 32
         /*
33 33
          * TODO:
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
          *             description // Question description text
42 42
          */
43 43
 
44
-        return view(
44
+        return view (
45 45
             'manager/applicant_profile',
46 46
             [
47 47
                 // Localization Strings.
48
-                'profile' => Lang::get('manager/applicant_profile'), // Change text
48
+                'profile' => Lang::get ('manager/applicant_profile'), // Change text
49 49
                 // User Data.
50 50
                 'user' => $applicant->user,
51 51
                 'applicant' => $applicant,
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
      * @param  \Illuminate\Http\Request $request Incoming request.
61 61
      * @return \Illuminate\Http\Response
62 62
      */
63
-    public function editAuthenticated(Request $request)
63
+    public function editAuthenticated (Request $request)
64 64
     {
65
-        $applicant = $request->user()->applicant;
66
-        return redirect(route('profile.about.edit', $applicant));
65
+        $applicant = $request->user ()->applicant;
66
+        return redirect (route ('profile.about.edit', $applicant));
67 67
     }
68 68
 
69 69
     /**
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
      * @param  \App\Models\Applicant    $applicant Applicant to view and edit.
74 74
      * @return \Illuminate\Http\Response
75 75
      */
76
-    public function edit(Request $request, Applicant $applicant)
76
+    public function edit (Request $request, Applicant $applicant)
77 77
     {
78
-        $profileQuestions = ApplicantProfileQuestion::all();
78
+        $profileQuestions = ApplicantProfileQuestion::all ();
79 79
 
80
-        $profileText = Lang::get('applicant/applicant_profile');
80
+        $profileText = Lang::get ('applicant/applicant_profile');
81 81
 
82 82
         $profileQuestionForms = [];
83 83
         foreach ($profileQuestions as $question) {
84 84
             $answerObj = $applicant->applicant_profile_answers
85
-                ->where('applicant_profile_question_id', $question->id)->first();
85
+                ->where ('applicant_profile_question_id', $question->id)->first ();
86 86
             $answer = $answerObj ? $answerObj->answer : null;
87 87
 
88 88
             $formValues = [
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
                 'answer_label' => $profileText['about_section']['answer_label'],
94 94
                 'input_name' => $this->answerFormInputName.'['.$question->id.']'
95 95
             ];
96
-            array_push($profileQuestionForms, $formValues);
96
+            array_push ($profileQuestionForms, $formValues);
97 97
         }
98 98
 
99 99
         $linkedInUrlPattern = LinkedInUrlRule::PATTERN;
100 100
         $twitterHandlePattern = TwitterHandleRule::PATTERN;
101 101
 
102
-        return view(
102
+        return view (
103 103
             'applicant/profile_01_about',
104 104
             [
105 105
                 // Localized strings.
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
                 'user' => $applicant->user,
111 111
                 'applicant' => $applicant,
112 112
                 'profile_photo_url' => '/images/user.png', // TODO: get real photos.
113
-                'form_submit_action' => route('profile.about.update', $applicant),
113
+                'form_submit_action' => route ('profile.about.update', $applicant),
114 114
                 'linkedInUrlPattern' => $linkedInUrlPattern,
115 115
                 'twitterHandlePattern' => $twitterHandlePattern,
116 116
             ]
@@ -124,44 +124,44 @@  discard block
 block discarded – undo
124 124
      * @param  \App\Models\Applicant    $applicant Applicant object to update.
125 125
      * @return \Illuminate\Http\Response
126 126
      */
127
-    public function update(Request $request, Applicant $applicant)
127
+    public function update (Request $request, Applicant $applicant)
128 128
     {
129
-        $questions = ApplicantProfileQuestion::all();
129
+        $questions = ApplicantProfileQuestion::all ();
130 130
 
131
-        $validator = new UpdateApplicationProfileValidator($applicant);
132
-        $validator->validate($request->all());
131
+        $validator = new UpdateApplicationProfileValidator ($applicant);
132
+        $validator->validate ($request->all ());
133 133
 
134 134
         foreach ($questions as $question) {
135
-            $answerName = $this->answerFormInputName . '.' . $question->id;
136
-            if ($request->has($answerName)) {
137
-                $answer = ApplicantProfileAnswer::where(
135
+            $answerName = $this->answerFormInputName.'.'.$question->id;
136
+            if ($request->has ($answerName)) {
137
+                $answer = ApplicantProfileAnswer::where (
138 138
                     [
139 139
                         'applicant_id' => $applicant->id,
140 140
                         'applicant_profile_question_id' => $question->id
141 141
                     ]
142
-                )->first();
142
+                )->first ();
143 143
                 if ($answer == null) {
144
-                    $answer = new ApplicantProfileAnswer();
145
-                    $answer->applicant_id =$applicant->id;
144
+                    $answer = new ApplicantProfileAnswer ();
145
+                    $answer->applicant_id = $applicant->id;
146 146
                     $answer->applicant_profile_question_id = $question->id;
147 147
                 }
148
-                $answer->answer = $request->input($answerName);
149
-                $answer->save();
148
+                $answer->answer = $request->input ($answerName);
149
+                $answer->save ();
150 150
             }
151 151
         }
152 152
 
153
-        $input = $request->input();
154
-        $applicant->fill(
153
+        $input = $request->input ();
154
+        $applicant->fill (
155 155
             [
156 156
                 'tagline' => $input['tagline'],
157 157
                 'twitter_username' => $input['twitter_username'],
158 158
                 'linkedin_url' => $input['linkedin_url'],
159 159
             ]
160 160
         );
161
-        $applicant->save();
161
+        $applicant->save ();
162 162
 
163 163
         $user = $applicant->user;
164
-        $user->fill(
164
+        $user->fill (
165 165
             [
166 166
                 'first_name' => $input['profile_first_name'],
167 167
                 'last_name' => $input['profile_last_name'],
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
             ]
170 170
         );
171 171
         if ($input['new_password']) {
172
-            $user->password = Hash::make($input['new_password']); // TODO: change password in seperate form!
172
+            $user->password = Hash::make ($input['new_password']); // TODO: change password in seperate form!
173 173
         }
174
-        $user->save();
174
+        $user->save ();
175 175
 
176
-        return redirect()->route('profile.about.edit', $applicant);
176
+        return redirect ()->route ('profile.about.edit', $applicant);
177 177
     }
178 178
 }
Please login to merge, or discard this patch.
app/Http/Controllers/JobBuilderController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@
 block discarded – undo
12 12
      * Show the Job Builder mini SPA
13 13
      * @return \Illuminate\Http\Response
14 14
      */
15
-    public function show()
15
+    public function show ()
16 16
     {
17
-        return view(
17
+        return view (
18 18
             'manager/job-builder-root'
19
-        )->with([
20
-            'title' => Lang::get('manager/job_builder.title'),
19
+        )->with ([
20
+            'title' => Lang::get ('manager/job_builder.title'),
21 21
         ]);
22 22
     }
23 23
 }
Please login to merge, or discard this patch.