@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $user->timezone = $this->config->get('app.timezone'); |
97 | 97 | } |
98 | 98 | |
99 | - if (! $this->save($user, $input)) { |
|
99 | + if (!$this->save($user, $input)) { |
|
100 | 100 | throw new GeneralException(__('exceptions.backend.users.create')); |
101 | 101 | } |
102 | 102 | |
@@ -116,17 +116,17 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function update(User $user, array $input) |
118 | 118 | { |
119 | - if (! $user->can_edit) { |
|
119 | + if (!$user->can_edit) { |
|
120 | 120 | throw new GeneralException(__('exceptions.backend.users.first_user_cannot_be_edited')); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $user->fill(Arr::except($input, 'password')); |
124 | 124 | |
125 | - if ($user->is_super_admin && ! $user->active) { |
|
125 | + if ($user->is_super_admin && !$user->active) { |
|
126 | 126 | throw new GeneralException(__('exceptions.backend.users.first_user_cannot_be_disabled')); |
127 | 127 | } |
128 | 128 | |
129 | - if (! $this->save($user, $input)) { |
|
129 | + if (!$this->save($user, $input)) { |
|
130 | 130 | throw new GeneralException(__('exceptions.backend.users.update')); |
131 | 131 | } |
132 | 132 | |
@@ -145,21 +145,21 @@ discard block |
||
145 | 145 | */ |
146 | 146 | private function save(User $user, array $input) |
147 | 147 | { |
148 | - if (isset($input['password']) && ! empty($input['password'])) { |
|
148 | + if (isset($input['password']) && !empty($input['password'])) { |
|
149 | 149 | $user->password = Hash::make($input['password']); |
150 | 150 | } |
151 | 151 | |
152 | - if (! $user->save()) { |
|
152 | + if (!$user->save()) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | |
156 | 156 | $roles = $input['roles'] ?? []; |
157 | 157 | |
158 | - if (! empty($roles)) { |
|
158 | + if (!empty($roles)) { |
|
159 | 159 | $allowedRoles = $this->roles->getAllowedRoles()->keyBy('id'); |
160 | 160 | |
161 | 161 | foreach ($roles as $id) { |
162 | - if (! $allowedRoles->has($id)) { |
|
162 | + if (!$allowedRoles->has($id)) { |
|
163 | 163 | throw new GeneralException(__('exceptions.backend.users.cannot_set_superior_roles')); |
164 | 164 | } |
165 | 165 | } |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function destroy(User $user) |
181 | 181 | { |
182 | - if (! $user->can_delete) { |
|
182 | + if (!$user->can_delete) { |
|
183 | 183 | throw new GeneralException(__('exceptions.backend.users.first_user_cannot_be_destroyed')); |
184 | 184 | } |
185 | 185 | |
186 | - if (! $user->delete()) { |
|
186 | + if (!$user->delete()) { |
|
187 | 187 | throw new GeneralException(__('exceptions.backend.users.delete')); |
188 | 188 | } |
189 | 189 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | return redirect()->route('admin.home'); |
214 | 214 | } |
215 | 215 | |
216 | - if (! session()->get('admin_user_id')) { |
|
216 | + if (!session()->get('admin_user_id')) { |
|
217 | 217 | session(['admin_user_id' => $authenticatedUser->id]); |
218 | 218 | session(['admin_user_name' => $authenticatedUser->name]); |
219 | 219 | session(['temp_user_id' => $user->id]); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function batchDestroy(array $ids) |
236 | 236 | { |
237 | - DB::transaction(function () use ($ids) { |
|
237 | + DB::transaction(function() use ($ids) { |
|
238 | 238 | // This wont call eloquent events, change to destroy if needed |
239 | 239 | if ($this->query()->whereIn('id', $ids)->delete()) { |
240 | 240 | return true; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function batchEnable(array $ids) |
257 | 257 | { |
258 | - DB::transaction(function () use ($ids) { |
|
258 | + DB::transaction(function() use ($ids) { |
|
259 | 259 | if ($this->query()->whereIn('id', $ids) |
260 | 260 | ->update(['active' => true]) |
261 | 261 | ) { |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function batchDisable(array $ids) |
279 | 279 | { |
280 | - DB::transaction(function () use ($ids) { |
|
280 | + DB::transaction(function() use ($ids) { |
|
281 | 281 | if ($this->query()->whereIn('id', $ids) |
282 | 282 | ->update(['active' => false]) |
283 | 283 | ) { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function create(array $data) : User |
101 | 101 | { |
102 | - return DB::transaction(function () use ($data) { |
|
102 | + return DB::transaction(function() use ($data) { |
|
103 | 103 | $user = parent::create([ |
104 | 104 | 'first_name' => $data['first_name'], |
105 | 105 | 'last_name' => $data['last_name'], |
@@ -111,13 +111,13 @@ discard block |
||
111 | 111 | ]); |
112 | 112 | |
113 | 113 | // See if adding any additional permissions |
114 | - if (! isset($data['permissions']) || ! count($data['permissions'])) { |
|
114 | + if (!isset($data['permissions']) || !count($data['permissions'])) { |
|
115 | 115 | $data['permissions'] = []; |
116 | 116 | } |
117 | 117 | |
118 | 118 | if ($user) { |
119 | 119 | // User must have at least one role |
120 | - if (! count($data['roles'])) { |
|
120 | + if (!count($data['roles'])) { |
|
121 | 121 | throw new GeneralException(__('exceptions.backend.access.users.role_needed_create')); |
122 | 122 | } |
123 | 123 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $user->syncPermissions($data['permissions']); |
127 | 127 | |
128 | 128 | //Send confirmation email if requested and account approval is off |
129 | - if (isset($data['confirmation_email']) && $user->confirmed == 0 && ! config('access.users.requires_approval')) { |
|
129 | + if (isset($data['confirmation_email']) && $user->confirmed == 0 && !config('access.users.requires_approval')) { |
|
130 | 130 | $user->notify(new UserNeedsConfirmation($user->confirmation_code)); |
131 | 131 | } |
132 | 132 | |
@@ -153,11 +153,11 @@ discard block |
||
153 | 153 | $this->checkUserByEmail($user, $data['email']); |
154 | 154 | |
155 | 155 | // See if adding any additional permissions |
156 | - if (! isset($data['permissions']) || ! count($data['permissions'])) { |
|
156 | + if (!isset($data['permissions']) || !count($data['permissions'])) { |
|
157 | 157 | $data['permissions'] = []; |
158 | 158 | } |
159 | 159 | |
160 | - return DB::transaction(function () use ($user, $data) { |
|
160 | + return DB::transaction(function() use ($user, $data) { |
|
161 | 161 | if ($user->update([ |
162 | 162 | 'first_name' => $data['first_name'], |
163 | 163 | 'last_name' => $data['last_name'], |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public function unconfirm(User $user) : User |
265 | 265 | { |
266 | - if (! $user->confirmed) { |
|
266 | + if (!$user->confirmed) { |
|
267 | 267 | throw new GeneralException(__('exceptions.backend.access.users.not_confirmed')); |
268 | 268 | } |
269 | 269 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | throw new GeneralException(__('exceptions.backend.access.users.delete_first')); |
304 | 304 | } |
305 | 305 | |
306 | - return DB::transaction(function () use ($user) { |
|
306 | + return DB::transaction(function() use ($user) { |
|
307 | 307 | // Delete associated relationships |
308 | 308 | $user->passwordHistories()->delete(); |
309 | 309 | $user->providers()->delete(); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | throw new GeneralException('A role already exists with the name '.$data['name']); |
36 | 36 | } |
37 | 37 | |
38 | - if (! isset($data['permissions']) || ! \count($data['permissions'])) { |
|
38 | + if (!isset($data['permissions']) || !\count($data['permissions'])) { |
|
39 | 39 | $data['permissions'] = []; |
40 | 40 | } |
41 | 41 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | throw new GeneralException(__('exceptions.backend.access.roles.needs_permission')); |
45 | 45 | } |
46 | 46 | |
47 | - return DB::transaction(function () use ($data) { |
|
47 | + return DB::transaction(function() use ($data) { |
|
48 | 48 | $role = parent::create(['name' => strtolower($data['name'])]); |
49 | 49 | |
50 | 50 | if ($role) { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | - if (! isset($data['permissions']) || ! \count($data['permissions'])) { |
|
82 | + if (!isset($data['permissions']) || !\count($data['permissions'])) { |
|
83 | 83 | $data['permissions'] = []; |
84 | 84 | } |
85 | 85 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | throw new GeneralException(__('exceptions.backend.access.roles.needs_permission')); |
89 | 89 | } |
90 | 90 | |
91 | - return DB::transaction(function () use ($role, $data) { |
|
91 | + return DB::transaction(function() use ($role, $data) { |
|
92 | 92 | if ($role->update([ |
93 | 93 | 'name' => strtolower($data['name']), |
94 | 94 | ])) { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** @var Role $role */ |
35 | 35 | $role = $this->make($input); |
36 | 36 | |
37 | - if (! $this->save($role, $input)) { |
|
37 | + if (!$this->save($role, $input)) { |
|
38 | 38 | throw new GeneralException(__('exceptions.backend.roles.create')); |
39 | 39 | } |
40 | 40 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $role->fill($input); |
56 | 56 | |
57 | - if (! $this->save($role, $input)) { |
|
57 | + if (!$this->save($role, $input)) { |
|
58 | 58 | throw new GeneralException(__('exceptions.backend.roles.update')); |
59 | 59 | } |
60 | 60 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | private function save(Role $role, array $input) |
73 | 73 | { |
74 | - if (! $role->save($input)) { |
|
74 | + if (!$role->save($input)) { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function destroy(Role $role) |
97 | 97 | { |
98 | - if (! $role->delete()) { |
|
98 | + if (!$role->delete()) { |
|
99 | 99 | throw new GeneralException(__('exceptions.backend.roles.delete')); |
100 | 100 | } |
101 | 101 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | $authenticatedUser = auth()->user(); |
111 | 111 | |
112 | - if (! $authenticatedUser) { |
|
112 | + if (!$authenticatedUser) { |
|
113 | 113 | return []; |
114 | 114 | } |
115 | 115 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | /** @var \Illuminate\Support\Collection $permissions */ |
123 | 123 | $permissions = $authenticatedUser->getPermissions(); |
124 | 124 | |
125 | - $roles = $roles->filter(function (Role $role) use ($permissions) { |
|
125 | + $roles = $roles->filter(function(Role $role) use ($permissions) { |
|
126 | 126 | foreach ($role->permissions as $permission) { |
127 | 127 | if (false === $permissions->search($permission, true)) { |
128 | 128 | return false; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /* @var User $user */ |
68 | 68 | $user->last_access_at = Carbon::now(); |
69 | 69 | |
70 | - if (! $user->save()) { |
|
70 | + if (!$user->save()) { |
|
71 | 71 | throw new GeneralException(__('exceptions.backend.users.update')); |
72 | 72 | } |
73 | 73 | |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | /** @var User $user */ |
94 | 94 | $user = $this->users->query()->whereEmail($user_email)->first(); |
95 | 95 | |
96 | - if (! $user) { |
|
96 | + if (!$user) { |
|
97 | 97 | // Registration is not enabled |
98 | - if (! config('account.can_register')) { |
|
98 | + if (!config('account.can_register')) { |
|
99 | 99 | throw new GeneralException(__('exceptions.frontend.auth.registration_disabled')); |
100 | 100 | } |
101 | 101 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | // Save new provider if needed |
110 | - if (! $user->getProvider($provider)) { |
|
110 | + if (!$user->getProvider($provider)) { |
|
111 | 111 | $user->providers()->save(new SocialLogin([ |
112 | 112 | 'provider' => $provider, |
113 | 113 | 'provider_id' => $data->getId(), |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function update(array $input) |
153 | 153 | { |
154 | - if (! config('account.updating_enabled')) { |
|
154 | + if (!config('account.updating_enabled')) { |
|
155 | 155 | throw new GeneralException(__('exceptions.frontend.user.updating_disabled')); |
156 | 156 | } |
157 | 157 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function changePassword($oldPassword, $newPassword) |
175 | 175 | { |
176 | - if (! config('account.updating_enabled')) { |
|
176 | + if (!config('account.updating_enabled')) { |
|
177 | 177 | throw new GeneralException(__('exceptions.frontend.user.updating_disabled')); |
178 | 178 | } |
179 | 179 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | throw new GeneralException(__('exceptions.backend.users.first_user_cannot_be_destroyed')); |
204 | 204 | } |
205 | 205 | |
206 | - if (! $user->delete()) { |
|
206 | + if (!$user->delete()) { |
|
207 | 207 | throw new GeneralException(__('exceptions.frontend.user.delete_account')); |
208 | 208 | } |
209 | 209 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $formSubmission->type = $type; |
43 | 43 | $formSubmission->data = json_encode($input); |
44 | 44 | |
45 | - DB::transaction(function () use ($formSubmission) { |
|
45 | + DB::transaction(function() use ($formSubmission) { |
|
46 | 46 | if ($formSubmission->save()) { |
47 | 47 | event(new FormSubmissionCreated($formSubmission)); |
48 | 48 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function destroy(FormSubmission $formSubmission) |
66 | 66 | { |
67 | - if (! $formSubmission->delete()) { |
|
67 | + if (!$formSubmission->delete()) { |
|
68 | 68 | throw new GeneralException(__('exceptions.backend.form_submissions.delete')); |
69 | 69 | } |
70 | 70 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function batchDestroy(array $ids) |
82 | 82 | { |
83 | - DB::transaction(function () use ($ids) { |
|
83 | + DB::transaction(function() use ($ids) { |
|
84 | 84 | // This wont call eloquent events, change to destroy if needed |
85 | 85 | if ($this->query()->whereIn('id', $ids)->delete()) { |
86 | 86 | return true; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | public function collection() |
31 | 31 | { |
32 | - return $this->query->get($this->columns)->each(function (Model $item) { |
|
32 | + return $this->query->get($this->columns)->each(function(Model $item) { |
|
33 | 33 | return $item->setAppends([]); |
34 | 34 | }); |
35 | 35 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | $this->posts->query() |
54 | 54 | ->where('status', '!=', Post::PUBLISHED) |
55 | 55 | ->where('published_at', '<', $now) |
56 | - ->where(function (Builder $q) use ($now) { |
|
56 | + ->where(function(Builder $q) use ($now) { |
|
57 | 57 | $q |
58 | 58 | ->whereNull('unpublished_at') |
59 | 59 | ->orWhere('unpublished_at', '>', $now); |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | public function passes($attribute, $value) |
40 | 40 | { |
41 | 41 | // Option is off |
42 | - if (! config('access.users.password_history')) { |
|
42 | + if (!config('access.users.password_history')) { |
|
43 | 43 | return true; |
44 | 44 | } |
45 | 45 | |
46 | - if (! $this->user instanceof User) { |
|
46 | + if (!$this->user instanceof User) { |
|
47 | 47 | if (is_numeric($this->user)) { |
48 | 48 | $this->user = resolve(BackendUserRepository::class)->getById($this->user); |
49 | 49 | } else { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | - if (! $this->user || null === $this->user) { |
|
54 | + if (!$this->user || null === $this->user) { |
|
55 | 55 | return false; |
56 | 56 | } |
57 | 57 |