@@ -8,282 +8,282 @@ |
||
8 | 8 | |
9 | 9 | class UsersController extends BaseApiController |
10 | 10 | { |
11 | - /** |
|
12 | - * The name of the model that is used by the base api controller |
|
13 | - * to preform actions like (add, edit ... etc). |
|
14 | - * @var string |
|
15 | - */ |
|
16 | - protected $model = 'users'; |
|
17 | - |
|
18 | - /** |
|
19 | - * List of all route actions that the base api controller |
|
20 | - * will skip permissions check for them. |
|
21 | - * @var array |
|
22 | - */ |
|
23 | - protected $skipPermissionCheck = ['account', 'logout', 'changePassword', 'saveProfile', 'account']; |
|
24 | - |
|
25 | - /** |
|
26 | - * List of all route actions that the base api controller |
|
27 | - * will skip login check for them. |
|
28 | - * @var array |
|
29 | - */ |
|
30 | - protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken', 'confirmEmail', 'resendEmailConfirmation']; |
|
31 | - |
|
32 | - /** |
|
33 | - * The validations rules used by the base api controller |
|
34 | - * to check before add. |
|
35 | - * @var array |
|
36 | - */ |
|
37 | - protected $validationRules = [ |
|
38 | - 'name' => 'nullable|string', |
|
39 | - 'email' => 'required|email|unique:users,email,{id}', |
|
40 | - 'password' => 'nullable|min:6' |
|
41 | - ]; |
|
42 | - |
|
43 | - /** |
|
44 | - * The loginProxy implementation. |
|
45 | - * |
|
46 | - * @var \App\Modules\Acl\Proxy\LoginProxy |
|
47 | - */ |
|
48 | - protected $loginProxy; |
|
49 | - |
|
50 | - public function __construct(LoginProxy $loginProxy) |
|
51 | - { |
|
52 | - $this->loginProxy = $loginProxy; |
|
53 | - parent::__construct(); |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * Return the logged in user account. |
|
58 | - * |
|
59 | - * @return \Illuminate\Http\Response |
|
60 | - */ |
|
61 | - public function account() |
|
62 | - { |
|
63 | - return \Response::json($this->repo->account($this->relations), 200); |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * Block the user. |
|
68 | - * |
|
69 | - * @param integer $id Id of the user. |
|
70 | - * @return \Illuminate\Http\Response |
|
71 | - */ |
|
72 | - public function block($id) |
|
73 | - { |
|
74 | - return \Response::json($this->repo->block($id), 200); |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Unblock the user. |
|
79 | - * |
|
80 | - * @param integer $id Id of the user. |
|
81 | - * @return \Illuminate\Http\Response |
|
82 | - */ |
|
83 | - public function unblock($id) |
|
84 | - { |
|
85 | - return \Response::json($this->repo->unblock($id), 200); |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * Logout the user. |
|
90 | - * |
|
91 | - * @return \Illuminate\Http\Response |
|
92 | - */ |
|
93 | - public function logout() |
|
94 | - { |
|
95 | - return \Response::json($this->loginProxy->logout(), 200); |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Handle a registration request. |
|
100 | - * |
|
101 | - * @param \Illuminate\Http\Request $request |
|
102 | - * @return \Illuminate\Http\Response |
|
103 | - */ |
|
104 | - public function register(Request $request) |
|
105 | - { |
|
106 | - $this->validate($request, [ |
|
107 | - 'name' => 'nullable|string', |
|
108 | - 'email' => 'required|email|unique:users,email,{id}', |
|
109 | - 'password' => 'required|min:6' |
|
110 | - ]); |
|
111 | - |
|
112 | - return \Response::json($this->repo->register($request->only('name', 'email', 'password')), 200); |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * Handle a login request to the application. |
|
117 | - * |
|
118 | - * @param \Illuminate\Http\Request $request |
|
119 | - * @return \Illuminate\Http\Response |
|
120 | - */ |
|
121 | - public function login(Request $request) |
|
122 | - { |
|
123 | - $this->validate($request, [ |
|
124 | - 'email' => 'required|email', |
|
125 | - 'password' => 'required|min:6', |
|
126 | - 'admin' => 'nullable|boolean' |
|
127 | - ]); |
|
128 | - |
|
129 | - return \Response::json($this->loginProxy->login($request->only('email', 'password'), $request->get('admin')), 200); |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * Handle a social login request of the none admin to the application. |
|
134 | - * |
|
135 | - * @param \Illuminate\Http\Request $request |
|
136 | - * @return \Illuminate\Http\Response |
|
137 | - */ |
|
138 | - public function loginSocial(Request $request) |
|
139 | - { |
|
140 | - $this->validate($request, [ |
|
141 | - 'auth_code' => 'required_without:access_token', |
|
142 | - 'access_token' => 'required_without:auth_code', |
|
143 | - 'type' => 'required|in:facebook,google' |
|
144 | - ]); |
|
145 | - |
|
146 | - return \Response::json($this->repo->loginSocial($request->only('auth_code', 'access_token', 'type')), 200); |
|
147 | - } |
|
148 | - |
|
149 | - /** |
|
150 | - * Assign the given groups to the given user. |
|
151 | - * |
|
152 | - * @param \Illuminate\Http\Request $request |
|
153 | - * @return \Illuminate\Http\Response |
|
154 | - */ |
|
155 | - public function assigngroups(Request $request) |
|
156 | - { |
|
157 | - $this->validate($request, [ |
|
158 | - 'group_ids' => 'required|exists:groups,id', |
|
159 | - 'user_id' => 'required|exists:users,id' |
|
160 | - ]); |
|
161 | - |
|
162 | - return \Response::json($this->repo->assignGroups($request->get('user_id'), $request->get('group_ids')), 200); |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * Send a reset link to the given user. |
|
167 | - * |
|
168 | - * @param \Illuminate\Http\Request $request |
|
169 | - * @return \Illuminate\Http\Response |
|
170 | - */ |
|
171 | - public function sendreset(Request $request) |
|
172 | - { |
|
173 | - $this->validate($request, ['email' => 'required|email']); |
|
174 | - |
|
175 | - return \Response::json($this->repo->sendReset($request->only('email')), 200); |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * Reset the given user's password. |
|
180 | - * |
|
181 | - * @param \Illuminate\Http\Request $request |
|
182 | - * @return \Illuminate\Http\Response |
|
183 | - */ |
|
184 | - public function resetpassword(Request $request) |
|
185 | - { |
|
186 | - $this->validate($request, [ |
|
187 | - 'token' => 'required', |
|
188 | - 'email' => 'required|email', |
|
189 | - 'password' => 'required|confirmed|min:6', |
|
190 | - 'password_confirmation' => 'required', |
|
191 | - ]); |
|
192 | - |
|
193 | - return \Response::json($this->repo->resetPassword($request->only('email', 'password', 'password_confirmation', 'token')), 200); |
|
194 | - } |
|
195 | - |
|
196 | - /** |
|
197 | - * Change the logged in user password. |
|
198 | - * |
|
199 | - * @param \Illuminate\Http\Request $request |
|
200 | - * @return \Illuminate\Http\Response |
|
201 | - */ |
|
202 | - public function changePassword(Request $request) |
|
203 | - { |
|
204 | - $this->validate($request, [ |
|
205 | - 'old_password' => 'required', |
|
206 | - 'password' => 'required|confirmed|min:6', |
|
207 | - 'password_confirmation' => 'required', |
|
208 | - ]); |
|
209 | - |
|
210 | - return \Response::json($this->repo->changePassword($request->only('old_password', 'password', 'password_confirmation')), 200); |
|
211 | - } |
|
212 | - |
|
213 | - /** |
|
214 | - * Confirm email using the confirmation code. |
|
215 | - * |
|
216 | - * @param \Illuminate\Http\Request $request |
|
217 | - * @return \Illuminate\Http\Response |
|
218 | - */ |
|
219 | - public function confirmEmail(Request $request) |
|
220 | - { |
|
221 | - $this->validate($request, [ |
|
222 | - 'confirmation_code' => 'required|string|exists:users,confirmation_code' |
|
223 | - ]); |
|
224 | - |
|
225 | - return \Response::json($this->repo->confirmEmail($request->only('confirmation_code')), 200); |
|
226 | - } |
|
227 | - |
|
228 | - /** |
|
229 | - * Resend the email confirmation mail. |
|
230 | - * |
|
231 | - * @param \Illuminate\Http\Request $request |
|
232 | - * @return \Illuminate\Http\Response |
|
233 | - */ |
|
234 | - public function resendEmailConfirmation(Request $request) |
|
235 | - { |
|
236 | - $this->validate($request, [ |
|
237 | - 'email' => 'required|exists:users,email' |
|
238 | - ]); |
|
239 | - |
|
240 | - return \Response::json($this->repo->sendConfirmationEmail($request->only('email')), 200); |
|
241 | - } |
|
242 | - |
|
243 | - /** |
|
244 | - * Refresh the expired login token. |
|
245 | - * |
|
246 | - * @param \Illuminate\Http\Request $request |
|
247 | - * @return \Illuminate\Http\Response |
|
248 | - */ |
|
249 | - public function refreshtoken(Request $request) |
|
250 | - { |
|
251 | - $this->validate($request, [ |
|
252 | - 'refreshtoken' => 'required', |
|
253 | - ]); |
|
254 | - |
|
255 | - return \Response::json($this->loginProxy->refreshtoken($request->get('refreshtoken')), 200); |
|
256 | - } |
|
257 | - |
|
258 | - /** |
|
259 | - * Paginate all users with in the given group. |
|
260 | - * |
|
261 | - * @param \Illuminate\Http\Request $request |
|
262 | - * @param string $groupName The name of the requested group. |
|
263 | - * @param integer $perPage Number of rows per page default 15. |
|
264 | - * @param string $sortBy The name of the column to sort by. |
|
265 | - * @param boolean $desc Sort ascending or descinding (1: desc, 0: asc). |
|
266 | - * @return \Illuminate\Http\Response |
|
267 | - */ |
|
268 | - public function group(Request $request, $groupName, $perPage = false, $sortBy = 'created_at', $desc = 1) |
|
269 | - { |
|
270 | - return \Response::json($this->repo->group($request->all(), $groupName, $this->relations, $perPage, $sortBy, $desc), 200); |
|
271 | - } |
|
272 | - |
|
273 | - /** |
|
274 | - * Save the given data to the logged in user. |
|
275 | - * |
|
276 | - * @param \Illuminate\Http\Request $request |
|
277 | - * @return \Illuminate\Http\Response |
|
278 | - */ |
|
279 | - public function saveProfile(Request $request) |
|
280 | - { |
|
281 | - $this->validate($request, [ |
|
282 | - 'profile_picture' => 'nullable|base64image', |
|
283 | - 'name' => 'nullable|string', |
|
284 | - 'email' => 'required|email|unique:users,email,' . \Auth::id() |
|
285 | - ]); |
|
286 | - |
|
287 | - return \Response::json($this->repo->saveProfile($request->only('name', 'email', 'profile_picture')), 200); |
|
288 | - } |
|
11 | + /** |
|
12 | + * The name of the model that is used by the base api controller |
|
13 | + * to preform actions like (add, edit ... etc). |
|
14 | + * @var string |
|
15 | + */ |
|
16 | + protected $model = 'users'; |
|
17 | + |
|
18 | + /** |
|
19 | + * List of all route actions that the base api controller |
|
20 | + * will skip permissions check for them. |
|
21 | + * @var array |
|
22 | + */ |
|
23 | + protected $skipPermissionCheck = ['account', 'logout', 'changePassword', 'saveProfile', 'account']; |
|
24 | + |
|
25 | + /** |
|
26 | + * List of all route actions that the base api controller |
|
27 | + * will skip login check for them. |
|
28 | + * @var array |
|
29 | + */ |
|
30 | + protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken', 'confirmEmail', 'resendEmailConfirmation']; |
|
31 | + |
|
32 | + /** |
|
33 | + * The validations rules used by the base api controller |
|
34 | + * to check before add. |
|
35 | + * @var array |
|
36 | + */ |
|
37 | + protected $validationRules = [ |
|
38 | + 'name' => 'nullable|string', |
|
39 | + 'email' => 'required|email|unique:users,email,{id}', |
|
40 | + 'password' => 'nullable|min:6' |
|
41 | + ]; |
|
42 | + |
|
43 | + /** |
|
44 | + * The loginProxy implementation. |
|
45 | + * |
|
46 | + * @var \App\Modules\Acl\Proxy\LoginProxy |
|
47 | + */ |
|
48 | + protected $loginProxy; |
|
49 | + |
|
50 | + public function __construct(LoginProxy $loginProxy) |
|
51 | + { |
|
52 | + $this->loginProxy = $loginProxy; |
|
53 | + parent::__construct(); |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * Return the logged in user account. |
|
58 | + * |
|
59 | + * @return \Illuminate\Http\Response |
|
60 | + */ |
|
61 | + public function account() |
|
62 | + { |
|
63 | + return \Response::json($this->repo->account($this->relations), 200); |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * Block the user. |
|
68 | + * |
|
69 | + * @param integer $id Id of the user. |
|
70 | + * @return \Illuminate\Http\Response |
|
71 | + */ |
|
72 | + public function block($id) |
|
73 | + { |
|
74 | + return \Response::json($this->repo->block($id), 200); |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Unblock the user. |
|
79 | + * |
|
80 | + * @param integer $id Id of the user. |
|
81 | + * @return \Illuminate\Http\Response |
|
82 | + */ |
|
83 | + public function unblock($id) |
|
84 | + { |
|
85 | + return \Response::json($this->repo->unblock($id), 200); |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * Logout the user. |
|
90 | + * |
|
91 | + * @return \Illuminate\Http\Response |
|
92 | + */ |
|
93 | + public function logout() |
|
94 | + { |
|
95 | + return \Response::json($this->loginProxy->logout(), 200); |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Handle a registration request. |
|
100 | + * |
|
101 | + * @param \Illuminate\Http\Request $request |
|
102 | + * @return \Illuminate\Http\Response |
|
103 | + */ |
|
104 | + public function register(Request $request) |
|
105 | + { |
|
106 | + $this->validate($request, [ |
|
107 | + 'name' => 'nullable|string', |
|
108 | + 'email' => 'required|email|unique:users,email,{id}', |
|
109 | + 'password' => 'required|min:6' |
|
110 | + ]); |
|
111 | + |
|
112 | + return \Response::json($this->repo->register($request->only('name', 'email', 'password')), 200); |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * Handle a login request to the application. |
|
117 | + * |
|
118 | + * @param \Illuminate\Http\Request $request |
|
119 | + * @return \Illuminate\Http\Response |
|
120 | + */ |
|
121 | + public function login(Request $request) |
|
122 | + { |
|
123 | + $this->validate($request, [ |
|
124 | + 'email' => 'required|email', |
|
125 | + 'password' => 'required|min:6', |
|
126 | + 'admin' => 'nullable|boolean' |
|
127 | + ]); |
|
128 | + |
|
129 | + return \Response::json($this->loginProxy->login($request->only('email', 'password'), $request->get('admin')), 200); |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * Handle a social login request of the none admin to the application. |
|
134 | + * |
|
135 | + * @param \Illuminate\Http\Request $request |
|
136 | + * @return \Illuminate\Http\Response |
|
137 | + */ |
|
138 | + public function loginSocial(Request $request) |
|
139 | + { |
|
140 | + $this->validate($request, [ |
|
141 | + 'auth_code' => 'required_without:access_token', |
|
142 | + 'access_token' => 'required_without:auth_code', |
|
143 | + 'type' => 'required|in:facebook,google' |
|
144 | + ]); |
|
145 | + |
|
146 | + return \Response::json($this->repo->loginSocial($request->only('auth_code', 'access_token', 'type')), 200); |
|
147 | + } |
|
148 | + |
|
149 | + /** |
|
150 | + * Assign the given groups to the given user. |
|
151 | + * |
|
152 | + * @param \Illuminate\Http\Request $request |
|
153 | + * @return \Illuminate\Http\Response |
|
154 | + */ |
|
155 | + public function assigngroups(Request $request) |
|
156 | + { |
|
157 | + $this->validate($request, [ |
|
158 | + 'group_ids' => 'required|exists:groups,id', |
|
159 | + 'user_id' => 'required|exists:users,id' |
|
160 | + ]); |
|
161 | + |
|
162 | + return \Response::json($this->repo->assignGroups($request->get('user_id'), $request->get('group_ids')), 200); |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * Send a reset link to the given user. |
|
167 | + * |
|
168 | + * @param \Illuminate\Http\Request $request |
|
169 | + * @return \Illuminate\Http\Response |
|
170 | + */ |
|
171 | + public function sendreset(Request $request) |
|
172 | + { |
|
173 | + $this->validate($request, ['email' => 'required|email']); |
|
174 | + |
|
175 | + return \Response::json($this->repo->sendReset($request->only('email')), 200); |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * Reset the given user's password. |
|
180 | + * |
|
181 | + * @param \Illuminate\Http\Request $request |
|
182 | + * @return \Illuminate\Http\Response |
|
183 | + */ |
|
184 | + public function resetpassword(Request $request) |
|
185 | + { |
|
186 | + $this->validate($request, [ |
|
187 | + 'token' => 'required', |
|
188 | + 'email' => 'required|email', |
|
189 | + 'password' => 'required|confirmed|min:6', |
|
190 | + 'password_confirmation' => 'required', |
|
191 | + ]); |
|
192 | + |
|
193 | + return \Response::json($this->repo->resetPassword($request->only('email', 'password', 'password_confirmation', 'token')), 200); |
|
194 | + } |
|
195 | + |
|
196 | + /** |
|
197 | + * Change the logged in user password. |
|
198 | + * |
|
199 | + * @param \Illuminate\Http\Request $request |
|
200 | + * @return \Illuminate\Http\Response |
|
201 | + */ |
|
202 | + public function changePassword(Request $request) |
|
203 | + { |
|
204 | + $this->validate($request, [ |
|
205 | + 'old_password' => 'required', |
|
206 | + 'password' => 'required|confirmed|min:6', |
|
207 | + 'password_confirmation' => 'required', |
|
208 | + ]); |
|
209 | + |
|
210 | + return \Response::json($this->repo->changePassword($request->only('old_password', 'password', 'password_confirmation')), 200); |
|
211 | + } |
|
212 | + |
|
213 | + /** |
|
214 | + * Confirm email using the confirmation code. |
|
215 | + * |
|
216 | + * @param \Illuminate\Http\Request $request |
|
217 | + * @return \Illuminate\Http\Response |
|
218 | + */ |
|
219 | + public function confirmEmail(Request $request) |
|
220 | + { |
|
221 | + $this->validate($request, [ |
|
222 | + 'confirmation_code' => 'required|string|exists:users,confirmation_code' |
|
223 | + ]); |
|
224 | + |
|
225 | + return \Response::json($this->repo->confirmEmail($request->only('confirmation_code')), 200); |
|
226 | + } |
|
227 | + |
|
228 | + /** |
|
229 | + * Resend the email confirmation mail. |
|
230 | + * |
|
231 | + * @param \Illuminate\Http\Request $request |
|
232 | + * @return \Illuminate\Http\Response |
|
233 | + */ |
|
234 | + public function resendEmailConfirmation(Request $request) |
|
235 | + { |
|
236 | + $this->validate($request, [ |
|
237 | + 'email' => 'required|exists:users,email' |
|
238 | + ]); |
|
239 | + |
|
240 | + return \Response::json($this->repo->sendConfirmationEmail($request->only('email')), 200); |
|
241 | + } |
|
242 | + |
|
243 | + /** |
|
244 | + * Refresh the expired login token. |
|
245 | + * |
|
246 | + * @param \Illuminate\Http\Request $request |
|
247 | + * @return \Illuminate\Http\Response |
|
248 | + */ |
|
249 | + public function refreshtoken(Request $request) |
|
250 | + { |
|
251 | + $this->validate($request, [ |
|
252 | + 'refreshtoken' => 'required', |
|
253 | + ]); |
|
254 | + |
|
255 | + return \Response::json($this->loginProxy->refreshtoken($request->get('refreshtoken')), 200); |
|
256 | + } |
|
257 | + |
|
258 | + /** |
|
259 | + * Paginate all users with in the given group. |
|
260 | + * |
|
261 | + * @param \Illuminate\Http\Request $request |
|
262 | + * @param string $groupName The name of the requested group. |
|
263 | + * @param integer $perPage Number of rows per page default 15. |
|
264 | + * @param string $sortBy The name of the column to sort by. |
|
265 | + * @param boolean $desc Sort ascending or descinding (1: desc, 0: asc). |
|
266 | + * @return \Illuminate\Http\Response |
|
267 | + */ |
|
268 | + public function group(Request $request, $groupName, $perPage = false, $sortBy = 'created_at', $desc = 1) |
|
269 | + { |
|
270 | + return \Response::json($this->repo->group($request->all(), $groupName, $this->relations, $perPage, $sortBy, $desc), 200); |
|
271 | + } |
|
272 | + |
|
273 | + /** |
|
274 | + * Save the given data to the logged in user. |
|
275 | + * |
|
276 | + * @param \Illuminate\Http\Request $request |
|
277 | + * @return \Illuminate\Http\Response |
|
278 | + */ |
|
279 | + public function saveProfile(Request $request) |
|
280 | + { |
|
281 | + $this->validate($request, [ |
|
282 | + 'profile_picture' => 'nullable|base64image', |
|
283 | + 'name' => 'nullable|string', |
|
284 | + 'email' => 'required|email|unique:users,email,' . \Auth::id() |
|
285 | + ]); |
|
286 | + |
|
287 | + return \Response::json($this->repo->saveProfile($request->only('name', 'email', 'profile_picture')), 200); |
|
288 | + } |
|
289 | 289 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * to preform actions like (add, edit ... etc). |
14 | 14 | * @var string |
15 | 15 | */ |
16 | - protected $model = 'users'; |
|
16 | + protected $model = 'users'; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * List of all route actions that the base api controller |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | * will skip login check for them. |
28 | 28 | * @var array |
29 | 29 | */ |
30 | - protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken', 'confirmEmail', 'resendEmailConfirmation']; |
|
30 | + protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken', 'confirmEmail', 'resendEmailConfirmation']; |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * The validations rules used by the base api controller |
34 | 34 | * to check before add. |
35 | 35 | * @var array |
36 | 36 | */ |
37 | - protected $validationRules = [ |
|
37 | + protected $validationRules = [ |
|
38 | 38 | 'name' => 'nullable|string', |
39 | 39 | 'email' => 'required|email|unique:users,email,{id}', |
40 | 40 | 'password' => 'nullable|min:6' |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $this->validate($request, [ |
282 | 282 | 'profile_picture' => 'nullable|base64image', |
283 | 283 | 'name' => 'nullable|string', |
284 | - 'email' => 'required|email|unique:users,email,' . \Auth::id() |
|
284 | + 'email' => 'required|email|unique:users,email,'.\Auth::id() |
|
285 | 285 | ]); |
286 | 286 | |
287 | 287 | return \Response::json($this->repo->saveProfile($request->only('name', 'email', 'profile_picture')), 200); |
@@ -5,56 +5,56 @@ |
||
5 | 5 | */ |
6 | 6 | class AclUserObserver { |
7 | 7 | |
8 | - public function saving($model) |
|
9 | - { |
|
10 | - // |
|
11 | - } |
|
12 | - |
|
13 | - public function saved($model) |
|
14 | - { |
|
15 | - // |
|
16 | - } |
|
17 | - |
|
18 | - public function creating($model) |
|
19 | - { |
|
20 | - // |
|
21 | - } |
|
22 | - |
|
23 | - public function created($model) |
|
24 | - { |
|
25 | - // |
|
26 | - } |
|
27 | - |
|
28 | - public function updating($model) |
|
29 | - { |
|
30 | - // |
|
31 | - } |
|
32 | - |
|
33 | - public function updated($model) |
|
34 | - { |
|
35 | - // |
|
36 | - } |
|
37 | - |
|
38 | - public function deleting($model) |
|
39 | - { |
|
40 | - if ($model->getOriginal('id') == \Auth::id()) |
|
41 | - { |
|
42 | - \ErrorHandler::noPermissions(); |
|
43 | - } |
|
44 | - } |
|
45 | - |
|
46 | - public function deleted($model) |
|
47 | - { |
|
48 | - // |
|
49 | - } |
|
50 | - |
|
51 | - public function restoring($model) |
|
52 | - { |
|
53 | - // |
|
54 | - } |
|
55 | - |
|
56 | - public function restored($model) |
|
57 | - { |
|
58 | - // |
|
59 | - } |
|
8 | + public function saving($model) |
|
9 | + { |
|
10 | + // |
|
11 | + } |
|
12 | + |
|
13 | + public function saved($model) |
|
14 | + { |
|
15 | + // |
|
16 | + } |
|
17 | + |
|
18 | + public function creating($model) |
|
19 | + { |
|
20 | + // |
|
21 | + } |
|
22 | + |
|
23 | + public function created($model) |
|
24 | + { |
|
25 | + // |
|
26 | + } |
|
27 | + |
|
28 | + public function updating($model) |
|
29 | + { |
|
30 | + // |
|
31 | + } |
|
32 | + |
|
33 | + public function updated($model) |
|
34 | + { |
|
35 | + // |
|
36 | + } |
|
37 | + |
|
38 | + public function deleting($model) |
|
39 | + { |
|
40 | + if ($model->getOriginal('id') == \Auth::id()) |
|
41 | + { |
|
42 | + \ErrorHandler::noPermissions(); |
|
43 | + } |
|
44 | + } |
|
45 | + |
|
46 | + public function deleted($model) |
|
47 | + { |
|
48 | + // |
|
49 | + } |
|
50 | + |
|
51 | + public function restoring($model) |
|
52 | + { |
|
53 | + // |
|
54 | + } |
|
55 | + |
|
56 | + public function restored($model) |
|
57 | + { |
|
58 | + // |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | \ No newline at end of file |
@@ -5,53 +5,53 @@ |
||
5 | 5 | */ |
6 | 6 | class OauthClientObserver { |
7 | 7 | |
8 | - public function saving($model) |
|
9 | - { |
|
10 | - // |
|
11 | - } |
|
12 | - |
|
13 | - public function saved($model) |
|
14 | - { |
|
15 | - // |
|
16 | - } |
|
17 | - |
|
18 | - public function creating($model) |
|
19 | - { |
|
20 | - $model->secret = str_random(40); |
|
21 | - } |
|
22 | - |
|
23 | - public function created($model) |
|
24 | - { |
|
25 | - // |
|
26 | - } |
|
27 | - |
|
28 | - public function updating($model) |
|
29 | - { |
|
30 | - // |
|
31 | - } |
|
32 | - |
|
33 | - public function updated($model) |
|
34 | - { |
|
35 | - // |
|
36 | - } |
|
37 | - |
|
38 | - public function deleting($model) |
|
39 | - { |
|
40 | - // |
|
41 | - } |
|
42 | - |
|
43 | - public function deleted($model) |
|
44 | - { |
|
45 | - // |
|
46 | - } |
|
47 | - |
|
48 | - public function restoring($model) |
|
49 | - { |
|
50 | - // |
|
51 | - } |
|
52 | - |
|
53 | - public function restored($model) |
|
54 | - { |
|
55 | - // |
|
56 | - } |
|
8 | + public function saving($model) |
|
9 | + { |
|
10 | + // |
|
11 | + } |
|
12 | + |
|
13 | + public function saved($model) |
|
14 | + { |
|
15 | + // |
|
16 | + } |
|
17 | + |
|
18 | + public function creating($model) |
|
19 | + { |
|
20 | + $model->secret = str_random(40); |
|
21 | + } |
|
22 | + |
|
23 | + public function created($model) |
|
24 | + { |
|
25 | + // |
|
26 | + } |
|
27 | + |
|
28 | + public function updating($model) |
|
29 | + { |
|
30 | + // |
|
31 | + } |
|
32 | + |
|
33 | + public function updated($model) |
|
34 | + { |
|
35 | + // |
|
36 | + } |
|
37 | + |
|
38 | + public function deleting($model) |
|
39 | + { |
|
40 | + // |
|
41 | + } |
|
42 | + |
|
43 | + public function deleted($model) |
|
44 | + { |
|
45 | + // |
|
46 | + } |
|
47 | + |
|
48 | + public function restoring($model) |
|
49 | + { |
|
50 | + // |
|
51 | + } |
|
52 | + |
|
53 | + public function restored($model) |
|
54 | + { |
|
55 | + // |
|
56 | + } |
|
57 | 57 | } |
58 | 58 | \ No newline at end of file |
@@ -5,71 +5,71 @@ |
||
5 | 5 | */ |
6 | 6 | class AclGroupObserver { |
7 | 7 | |
8 | - public function saving($model) |
|
9 | - { |
|
10 | - // |
|
11 | - } |
|
8 | + public function saving($model) |
|
9 | + { |
|
10 | + // |
|
11 | + } |
|
12 | 12 | |
13 | - public function saved($model) |
|
14 | - { |
|
15 | - // |
|
16 | - } |
|
13 | + public function saved($model) |
|
14 | + { |
|
15 | + // |
|
16 | + } |
|
17 | 17 | |
18 | - public function creating($model) |
|
19 | - { |
|
20 | - // |
|
21 | - } |
|
18 | + public function creating($model) |
|
19 | + { |
|
20 | + // |
|
21 | + } |
|
22 | 22 | |
23 | - public function created($model) |
|
24 | - { |
|
25 | - // |
|
26 | - } |
|
23 | + public function created($model) |
|
24 | + { |
|
25 | + // |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Prevent updating of the admin group. |
|
30 | - * |
|
31 | - * @param object $model the model beign updated. |
|
32 | - * @return void |
|
33 | - */ |
|
34 | - public function updating($model) |
|
35 | - { |
|
36 | - if ($model->getOriginal('name') == 'Admin') |
|
37 | - { |
|
38 | - \ErrorHandler::noPermissions(); |
|
39 | - } |
|
40 | - } |
|
28 | + /** |
|
29 | + * Prevent updating of the admin group. |
|
30 | + * |
|
31 | + * @param object $model the model beign updated. |
|
32 | + * @return void |
|
33 | + */ |
|
34 | + public function updating($model) |
|
35 | + { |
|
36 | + if ($model->getOriginal('name') == 'Admin') |
|
37 | + { |
|
38 | + \ErrorHandler::noPermissions(); |
|
39 | + } |
|
40 | + } |
|
41 | 41 | |
42 | - public function updated($model) |
|
43 | - { |
|
44 | - // |
|
45 | - } |
|
42 | + public function updated($model) |
|
43 | + { |
|
44 | + // |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Prevent deleting the admin group. |
|
49 | - * |
|
50 | - * @param object $model the delted model. |
|
51 | - * @return void |
|
52 | - */ |
|
53 | - public function deleting($model) |
|
54 | - { |
|
55 | - if ($model->getOriginal('name') == 'Admin') |
|
56 | - { |
|
57 | - \ErrorHandler::noPermissions(); |
|
58 | - } |
|
59 | - } |
|
47 | + /** |
|
48 | + * Prevent deleting the admin group. |
|
49 | + * |
|
50 | + * @param object $model the delted model. |
|
51 | + * @return void |
|
52 | + */ |
|
53 | + public function deleting($model) |
|
54 | + { |
|
55 | + if ($model->getOriginal('name') == 'Admin') |
|
56 | + { |
|
57 | + \ErrorHandler::noPermissions(); |
|
58 | + } |
|
59 | + } |
|
60 | 60 | |
61 | - public function deleted($model) |
|
62 | - { |
|
63 | - // |
|
64 | - } |
|
61 | + public function deleted($model) |
|
62 | + { |
|
63 | + // |
|
64 | + } |
|
65 | 65 | |
66 | - public function restoring($model) |
|
67 | - { |
|
68 | - // |
|
69 | - } |
|
66 | + public function restoring($model) |
|
67 | + { |
|
68 | + // |
|
69 | + } |
|
70 | 70 | |
71 | - public function restored($model) |
|
72 | - { |
|
73 | - // |
|
74 | - } |
|
71 | + public function restored($model) |
|
72 | + { |
|
73 | + // |
|
74 | + } |
|
75 | 75 | } |
76 | 76 | \ No newline at end of file |
@@ -5,53 +5,53 @@ |
||
5 | 5 | */ |
6 | 6 | class AclPermissionObserver { |
7 | 7 | |
8 | - public function saving($model) |
|
9 | - { |
|
10 | - // |
|
11 | - } |
|
12 | - |
|
13 | - public function saved($model) |
|
14 | - { |
|
15 | - // |
|
16 | - } |
|
17 | - |
|
18 | - public function creating($model) |
|
19 | - { |
|
20 | - // |
|
21 | - } |
|
22 | - |
|
23 | - public function created($model) |
|
24 | - { |
|
25 | - // |
|
26 | - } |
|
27 | - |
|
28 | - public function updating($model) |
|
29 | - { |
|
30 | - // |
|
31 | - } |
|
32 | - |
|
33 | - public function updated($model) |
|
34 | - { |
|
35 | - // |
|
36 | - } |
|
37 | - |
|
38 | - public function deleting($model) |
|
39 | - { |
|
40 | - // |
|
41 | - } |
|
42 | - |
|
43 | - public function deleted($model) |
|
44 | - { |
|
45 | - // |
|
46 | - } |
|
47 | - |
|
48 | - public function restoring($model) |
|
49 | - { |
|
50 | - // |
|
51 | - } |
|
52 | - |
|
53 | - public function restored($model) |
|
54 | - { |
|
55 | - // |
|
56 | - } |
|
8 | + public function saving($model) |
|
9 | + { |
|
10 | + // |
|
11 | + } |
|
12 | + |
|
13 | + public function saved($model) |
|
14 | + { |
|
15 | + // |
|
16 | + } |
|
17 | + |
|
18 | + public function creating($model) |
|
19 | + { |
|
20 | + // |
|
21 | + } |
|
22 | + |
|
23 | + public function created($model) |
|
24 | + { |
|
25 | + // |
|
26 | + } |
|
27 | + |
|
28 | + public function updating($model) |
|
29 | + { |
|
30 | + // |
|
31 | + } |
|
32 | + |
|
33 | + public function updated($model) |
|
34 | + { |
|
35 | + // |
|
36 | + } |
|
37 | + |
|
38 | + public function deleting($model) |
|
39 | + { |
|
40 | + // |
|
41 | + } |
|
42 | + |
|
43 | + public function deleted($model) |
|
44 | + { |
|
45 | + // |
|
46 | + } |
|
47 | + |
|
48 | + public function restoring($model) |
|
49 | + { |
|
50 | + // |
|
51 | + } |
|
52 | + |
|
53 | + public function restored($model) |
|
54 | + { |
|
55 | + // |
|
56 | + } |
|
57 | 57 | } |
58 | 58 | \ No newline at end of file |
@@ -29,6 +29,6 @@ |
||
29 | 29 | $group->permissions()->attach($permissionIds); |
30 | 30 | }); |
31 | 31 | |
32 | - return $this->find($groupId); |
|
32 | + return $this->find($groupId); |
|
33 | 33 | } |
34 | 34 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function assignPermissions($groupId, $permissionIds) |
25 | 25 | { |
26 | - \DB::transaction(function () use ($groupId, $permissionIds) { |
|
26 | + \DB::transaction(function() use ($groupId, $permissionIds) { |
|
27 | 27 | $group = $this->find($groupId); |
28 | 28 | $group->permissions()->detach(); |
29 | 29 | $group->permissions()->attach($permissionIds); |
@@ -4,37 +4,37 @@ |
||
4 | 4 | |
5 | 5 | class OauthClientRepository extends AbstractRepository |
6 | 6 | { |
7 | - /** |
|
8 | - * Return the model full namespace. |
|
9 | - * |
|
10 | - * @return string |
|
11 | - */ |
|
12 | - protected function getModel() |
|
13 | - { |
|
14 | - return 'App\Modules\Acl\OauthClient'; |
|
15 | - } |
|
7 | + /** |
|
8 | + * Return the model full namespace. |
|
9 | + * |
|
10 | + * @return string |
|
11 | + */ |
|
12 | + protected function getModel() |
|
13 | + { |
|
14 | + return 'App\Modules\Acl\OauthClient'; |
|
15 | + } |
|
16 | 16 | |
17 | - /** |
|
18 | - * Revoke the given client. |
|
19 | - * |
|
20 | - * @param integer $clientId |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function revoke($clientId) |
|
24 | - { |
|
25 | - $client = $this->find($clientId); |
|
26 | - $client->tokens()->update(['revoked' => true]); |
|
27 | - $this->save(['id'=> $clientId, 'revoked' => true]); |
|
28 | - } |
|
17 | + /** |
|
18 | + * Revoke the given client. |
|
19 | + * |
|
20 | + * @param integer $clientId |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function revoke($clientId) |
|
24 | + { |
|
25 | + $client = $this->find($clientId); |
|
26 | + $client->tokens()->update(['revoked' => true]); |
|
27 | + $this->save(['id'=> $clientId, 'revoked' => true]); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Un revoke the given client. |
|
32 | - * |
|
33 | - * @param integer $clientId |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function unRevoke($clientId) |
|
37 | - { |
|
38 | - $this->save(['id'=> $clientId, 'revoked' => false]); |
|
39 | - } |
|
30 | + /** |
|
31 | + * Un revoke the given client. |
|
32 | + * |
|
33 | + * @param integer $clientId |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function unRevoke($clientId) |
|
37 | + { |
|
38 | + $this->save(['id'=> $clientId, 'revoked' => false]); |
|
39 | + } |
|
40 | 40 | } |
@@ -2,67 +2,67 @@ |
||
2 | 2 | |
3 | 3 | class Media |
4 | 4 | { |
5 | - /** |
|
6 | - * Upload the given image. |
|
7 | - * |
|
8 | - * @param object $image |
|
9 | - * @param string $dir |
|
10 | - * @return string |
|
11 | - */ |
|
12 | - public function uploadImage($image, $dir) |
|
13 | - { |
|
14 | - $response = []; |
|
15 | - $image = $image; |
|
16 | - $imageName = str_slug('image' . uniqid() . time() . '_' . $image->getClientOriginalName()); |
|
17 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
5 | + /** |
|
6 | + * Upload the given image. |
|
7 | + * |
|
8 | + * @param object $image |
|
9 | + * @param string $dir |
|
10 | + * @return string |
|
11 | + */ |
|
12 | + public function uploadImage($image, $dir) |
|
13 | + { |
|
14 | + $response = []; |
|
15 | + $image = $image; |
|
16 | + $imageName = str_slug('image' . uniqid() . time() . '_' . $image->getClientOriginalName()); |
|
17 | + $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
18 | 18 | |
19 | - ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
|
20 | - $image->move($destinationPath, $imageName); |
|
19 | + ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
|
20 | + $image->move($destinationPath, $imageName); |
|
21 | 21 | |
22 | - return url($destinationPath . $imageName); |
|
23 | - } |
|
22 | + return url($destinationPath . $imageName); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * Upload the given image. |
|
27 | - * |
|
28 | - * @param object $image |
|
29 | - * @param string $dir |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function uploadImageBas64($image, $dir) |
|
33 | - { |
|
34 | - if (! strlen($image)) |
|
35 | - { |
|
36 | - return null; |
|
37 | - } |
|
25 | + /** |
|
26 | + * Upload the given image. |
|
27 | + * |
|
28 | + * @param object $image |
|
29 | + * @param string $dir |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function uploadImageBas64($image, $dir) |
|
33 | + { |
|
34 | + if (! strlen($image)) |
|
35 | + { |
|
36 | + return null; |
|
37 | + } |
|
38 | 38 | |
39 | - $response = []; |
|
40 | - $image = $image; |
|
41 | - $imageName = 'image' . uniqid() . time() . '.jpg'; |
|
42 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
39 | + $response = []; |
|
40 | + $image = $image; |
|
41 | + $imageName = 'image' . uniqid() . time() . '.jpg'; |
|
42 | + $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
43 | 43 | |
44 | - ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
|
44 | + ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
|
45 | 45 | |
46 | - $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
|
47 | - $image = \Image::make($base)->save($destinationPath . $imageName); |
|
46 | + $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
|
47 | + $image = \Image::make($base)->save($destinationPath . $imageName); |
|
48 | 48 | |
49 | - return url($destinationPath . $imageName); |
|
50 | - } |
|
49 | + return url($destinationPath . $imageName); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Delete the given image. |
|
54 | - * |
|
55 | - * @param object $path |
|
56 | - * @param string $dir |
|
57 | - * @return void |
|
58 | - */ |
|
59 | - public function deleteImage($path, $dir) |
|
60 | - { |
|
61 | - $arr = explode('/', $path); |
|
62 | - $path = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . end($arr); |
|
63 | - if (\File::exists($path)) |
|
64 | - { |
|
65 | - \File::delete($path); |
|
66 | - } |
|
67 | - } |
|
52 | + /** |
|
53 | + * Delete the given image. |
|
54 | + * |
|
55 | + * @param object $path |
|
56 | + * @param string $dir |
|
57 | + * @return void |
|
58 | + */ |
|
59 | + public function deleteImage($path, $dir) |
|
60 | + { |
|
61 | + $arr = explode('/', $path); |
|
62 | + $path = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . end($arr); |
|
63 | + if (\File::exists($path)) |
|
64 | + { |
|
65 | + \File::delete($path); |
|
66 | + } |
|
67 | + } |
|
68 | 68 | } |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | { |
14 | 14 | $response = []; |
15 | 15 | $image = $image; |
16 | - $imageName = str_slug('image' . uniqid() . time() . '_' . $image->getClientOriginalName()); |
|
17 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
16 | + $imageName = str_slug('image'.uniqid().time().'_'.$image->getClientOriginalName()); |
|
17 | + $destinationPath = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
18 | 18 | |
19 | 19 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
20 | 20 | $image->move($destinationPath, $imageName); |
21 | 21 | |
22 | - return url($destinationPath . $imageName); |
|
22 | + return url($destinationPath.$imageName); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -31,22 +31,22 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function uploadImageBas64($image, $dir) |
33 | 33 | { |
34 | - if (! strlen($image)) |
|
34 | + if ( ! strlen($image)) |
|
35 | 35 | { |
36 | 36 | return null; |
37 | 37 | } |
38 | 38 | |
39 | 39 | $response = []; |
40 | 40 | $image = $image; |
41 | - $imageName = 'image' . uniqid() . time() . '.jpg'; |
|
42 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
41 | + $imageName = 'image'.uniqid().time().'.jpg'; |
|
42 | + $destinationPath = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
43 | 43 | |
44 | 44 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
45 | 45 | |
46 | 46 | $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
47 | - $image = \Image::make($base)->save($destinationPath . $imageName); |
|
47 | + $image = \Image::make($base)->save($destinationPath.$imageName); |
|
48 | 48 | |
49 | - return url($destinationPath . $imageName); |
|
49 | + return url($destinationPath.$imageName); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function deleteImage($path, $dir) |
60 | 60 | { |
61 | 61 | $arr = explode('/', $path); |
62 | - $path = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . end($arr); |
|
62 | + $path = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.end($arr); |
|
63 | 63 | if (\File::exists($path)) |
64 | 64 | { |
65 | 65 | \File::delete($path); |
@@ -2,117 +2,117 @@ |
||
2 | 2 | |
3 | 3 | class ErrorHandler |
4 | 4 | { |
5 | - public function unAuthorized() |
|
6 | - { |
|
7 | - $error = ['status' => 401, 'message' => trans('errors.unAuthorized')]; |
|
8 | - abort($error['status'], $error['message']); |
|
9 | - } |
|
10 | - |
|
11 | - public function invalidRefreshToken() |
|
12 | - { |
|
13 | - $error = ['status' => 400, 'message' => trans('errors.invalidRefreshToken')]; |
|
14 | - abort($error['status'], $error['message']); |
|
15 | - } |
|
16 | - |
|
17 | - public function noPermissions() |
|
18 | - { |
|
19 | - $error = ['status' => 403, 'message' => trans('errors.noPermissions')]; |
|
20 | - abort($error['status'], $error['message']); |
|
21 | - } |
|
22 | - |
|
23 | - public function loginFailed() |
|
24 | - { |
|
25 | - $error = ['status' => 400, 'message' => trans('errors.loginFailed')]; |
|
26 | - abort($error['status'], $error['message']); |
|
27 | - } |
|
28 | - |
|
29 | - public function noSocialEmail() |
|
30 | - { |
|
31 | - $error = ['status' => 400, 'message' => trans('errors.noSocialEmail')]; |
|
32 | - abort($error['status'], $error['message']); |
|
33 | - } |
|
34 | - |
|
35 | - public function userAlreadyRegistered() |
|
36 | - { |
|
37 | - $error = ['status' => 400, 'message' => trans('errors.userAlreadyRegistered')]; |
|
38 | - abort($error['status'], $error['message']); |
|
39 | - } |
|
40 | - |
|
41 | - public function connectionError() |
|
42 | - { |
|
43 | - $error = ['status' => 400, 'message' => trans('errors.connectionError')]; |
|
44 | - abort($error['status'], $error['message']); |
|
45 | - } |
|
46 | - |
|
47 | - public function redisNotRunning() |
|
48 | - { |
|
49 | - $error = ['status' => 400, 'message' => trans('errors.redisNotRunning')]; |
|
50 | - abort($error['status'], $error['message']); |
|
51 | - } |
|
52 | - |
|
53 | - public function dbQueryError() |
|
54 | - { |
|
55 | - $error = ['status' => 400, 'message' => trans('errors.dbQueryError')]; |
|
56 | - abort($error['status'], $error['message']); |
|
57 | - } |
|
58 | - |
|
59 | - public function cannotCreateSetting() |
|
60 | - { |
|
61 | - $error = ['status' => 400, 'message' => trans('errors.cannotCreateSetting')]; |
|
62 | - abort($error['status'], $error['message']); |
|
63 | - } |
|
64 | - |
|
65 | - public function cannotUpdateSettingKey() |
|
66 | - { |
|
67 | - $error = ['status' => 400, 'message' => trans('errors.cannotUpdateSettingKey')]; |
|
68 | - abort($error['status'], $error['message']); |
|
69 | - } |
|
70 | - |
|
71 | - public function userIsBlocked() |
|
72 | - { |
|
73 | - $error = ['status' => 403, 'message' => trans('errors.userIsBlocked')]; |
|
74 | - abort($error['status'], $error['message']); |
|
75 | - } |
|
76 | - |
|
77 | - public function emailNotConfirmed() |
|
78 | - { |
|
79 | - $error = ['status' => 403, 'message' => trans('errors.emailNotConfirmed')]; |
|
80 | - abort($error['status'], $error['message']); |
|
81 | - } |
|
82 | - |
|
83 | - public function emailAlreadyConfirmed() |
|
84 | - { |
|
85 | - $error = ['status' => 403, 'message' => trans('errors.emailAlreadyConfirmed')]; |
|
86 | - abort($error['status'], $error['message']); |
|
87 | - } |
|
88 | - |
|
89 | - public function invalidResetToken() |
|
90 | - { |
|
91 | - $error = ['status' => 400, 'message' => trans('errors.invalidResetToken')]; |
|
92 | - abort($error['status'], $error['message']); |
|
93 | - } |
|
94 | - |
|
95 | - public function invalidResetPassword() |
|
96 | - { |
|
97 | - $error = ['status' => 400, 'message' => trans('errors.invalidResetPassword')]; |
|
98 | - abort($error['status'], $error['message']); |
|
99 | - } |
|
100 | - |
|
101 | - public function invalidOldPassword() |
|
102 | - { |
|
103 | - $error = ['status' => 400, 'message' => trans('errors.invalidOldPassword')]; |
|
104 | - abort($error['status'], $error['message']); |
|
105 | - } |
|
106 | - |
|
107 | - public function notFound($text) |
|
108 | - { |
|
109 | - $error = ['status' => 404, 'message' => trans('errors.notFound', ['replace' => $text])]; |
|
110 | - abort($error['status'], $error['message']); |
|
111 | - } |
|
112 | - |
|
113 | - public function generalError() |
|
114 | - { |
|
115 | - $error = ['status' => 400, 'message' => trans('errors.generalError')]; |
|
116 | - abort($error['status'], $error['message']); |
|
117 | - } |
|
5 | + public function unAuthorized() |
|
6 | + { |
|
7 | + $error = ['status' => 401, 'message' => trans('errors.unAuthorized')]; |
|
8 | + abort($error['status'], $error['message']); |
|
9 | + } |
|
10 | + |
|
11 | + public function invalidRefreshToken() |
|
12 | + { |
|
13 | + $error = ['status' => 400, 'message' => trans('errors.invalidRefreshToken')]; |
|
14 | + abort($error['status'], $error['message']); |
|
15 | + } |
|
16 | + |
|
17 | + public function noPermissions() |
|
18 | + { |
|
19 | + $error = ['status' => 403, 'message' => trans('errors.noPermissions')]; |
|
20 | + abort($error['status'], $error['message']); |
|
21 | + } |
|
22 | + |
|
23 | + public function loginFailed() |
|
24 | + { |
|
25 | + $error = ['status' => 400, 'message' => trans('errors.loginFailed')]; |
|
26 | + abort($error['status'], $error['message']); |
|
27 | + } |
|
28 | + |
|
29 | + public function noSocialEmail() |
|
30 | + { |
|
31 | + $error = ['status' => 400, 'message' => trans('errors.noSocialEmail')]; |
|
32 | + abort($error['status'], $error['message']); |
|
33 | + } |
|
34 | + |
|
35 | + public function userAlreadyRegistered() |
|
36 | + { |
|
37 | + $error = ['status' => 400, 'message' => trans('errors.userAlreadyRegistered')]; |
|
38 | + abort($error['status'], $error['message']); |
|
39 | + } |
|
40 | + |
|
41 | + public function connectionError() |
|
42 | + { |
|
43 | + $error = ['status' => 400, 'message' => trans('errors.connectionError')]; |
|
44 | + abort($error['status'], $error['message']); |
|
45 | + } |
|
46 | + |
|
47 | + public function redisNotRunning() |
|
48 | + { |
|
49 | + $error = ['status' => 400, 'message' => trans('errors.redisNotRunning')]; |
|
50 | + abort($error['status'], $error['message']); |
|
51 | + } |
|
52 | + |
|
53 | + public function dbQueryError() |
|
54 | + { |
|
55 | + $error = ['status' => 400, 'message' => trans('errors.dbQueryError')]; |
|
56 | + abort($error['status'], $error['message']); |
|
57 | + } |
|
58 | + |
|
59 | + public function cannotCreateSetting() |
|
60 | + { |
|
61 | + $error = ['status' => 400, 'message' => trans('errors.cannotCreateSetting')]; |
|
62 | + abort($error['status'], $error['message']); |
|
63 | + } |
|
64 | + |
|
65 | + public function cannotUpdateSettingKey() |
|
66 | + { |
|
67 | + $error = ['status' => 400, 'message' => trans('errors.cannotUpdateSettingKey')]; |
|
68 | + abort($error['status'], $error['message']); |
|
69 | + } |
|
70 | + |
|
71 | + public function userIsBlocked() |
|
72 | + { |
|
73 | + $error = ['status' => 403, 'message' => trans('errors.userIsBlocked')]; |
|
74 | + abort($error['status'], $error['message']); |
|
75 | + } |
|
76 | + |
|
77 | + public function emailNotConfirmed() |
|
78 | + { |
|
79 | + $error = ['status' => 403, 'message' => trans('errors.emailNotConfirmed')]; |
|
80 | + abort($error['status'], $error['message']); |
|
81 | + } |
|
82 | + |
|
83 | + public function emailAlreadyConfirmed() |
|
84 | + { |
|
85 | + $error = ['status' => 403, 'message' => trans('errors.emailAlreadyConfirmed')]; |
|
86 | + abort($error['status'], $error['message']); |
|
87 | + } |
|
88 | + |
|
89 | + public function invalidResetToken() |
|
90 | + { |
|
91 | + $error = ['status' => 400, 'message' => trans('errors.invalidResetToken')]; |
|
92 | + abort($error['status'], $error['message']); |
|
93 | + } |
|
94 | + |
|
95 | + public function invalidResetPassword() |
|
96 | + { |
|
97 | + $error = ['status' => 400, 'message' => trans('errors.invalidResetPassword')]; |
|
98 | + abort($error['status'], $error['message']); |
|
99 | + } |
|
100 | + |
|
101 | + public function invalidOldPassword() |
|
102 | + { |
|
103 | + $error = ['status' => 400, 'message' => trans('errors.invalidOldPassword')]; |
|
104 | + abort($error['status'], $error['message']); |
|
105 | + } |
|
106 | + |
|
107 | + public function notFound($text) |
|
108 | + { |
|
109 | + $error = ['status' => 404, 'message' => trans('errors.notFound', ['replace' => $text])]; |
|
110 | + abort($error['status'], $error['message']); |
|
111 | + } |
|
112 | + |
|
113 | + public function generalError() |
|
114 | + { |
|
115 | + $error = ['status' => 400, 'message' => trans('errors.generalError')]; |
|
116 | + abort($error['status'], $error['message']); |
|
117 | + } |
|
118 | 118 | } |
119 | 119 | \ No newline at end of file |