@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | $response = $this->broker()->reset( |
63 | 63 | $this->credentials($request), |
64 | - function ($user, $password) { |
|
64 | + function($user, $password) { |
|
65 | 65 | $this->resetPassword($user, $password); |
66 | 66 | } |
67 | 67 | ); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $response == Password::PASSWORD_RESET |
71 | 71 | ? $this->sendSuccessResponse() |
72 | 72 | : $this->sendFailedResponse( |
73 | - ['token' => 'Your reset link has expired. Please try to resend it again.'], |
|
73 | + [ 'token' => 'Your reset link has expired. Please try to resend it again.' ], |
|
74 | 74 | self::HTTP_CODE_BAD_REQUEST |
75 | 75 | ); |
76 | 76 | } |
@@ -17,66 +17,66 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function sendFailedResponse(array $errors, int $statusCode) |
19 | 19 | { |
20 | - $errorsJson = []; |
|
21 | - if (!empty($errors['email'])) { |
|
20 | + $errorsJson = [ ]; |
|
21 | + if (!empty($errors[ 'email' ])) { |
|
22 | 22 | $emailError = [ |
23 | 23 | 'status' => $statusCode, |
24 | 24 | 'title' => 'Email error', |
25 | - 'detail' => $errors['email'][0] |
|
25 | + 'detail' => $errors[ 'email' ][ 0 ] |
|
26 | 26 | ]; |
27 | 27 | array_push($errorsJson, $emailError); |
28 | 28 | } |
29 | 29 | |
30 | - if (!empty($errors['password'])) { |
|
30 | + if (!empty($errors[ 'password' ])) { |
|
31 | 31 | $passwordError = [ |
32 | 32 | 'status' => $statusCode, |
33 | 33 | 'title' => 'Password error', |
34 | - 'detail' => $errors['password'][0] |
|
34 | + 'detail' => $errors[ 'password' ][ 0 ] |
|
35 | 35 | ]; |
36 | 36 | array_push($errorsJson, $passwordError); |
37 | 37 | } |
38 | 38 | |
39 | - if (!empty($errors['password_confirmation'])) { |
|
39 | + if (!empty($errors[ 'password_confirmation' ])) { |
|
40 | 40 | $passwordConfirmationError = [ |
41 | 41 | 'status' => $statusCode, |
42 | 42 | 'title' => 'Password error', |
43 | - 'detail' => $errors['password_confirmation'][0] |
|
43 | + 'detail' => $errors[ 'password_confirmation' ][ 0 ] |
|
44 | 44 | ]; |
45 | 45 | array_push($errorsJson, $passwordConfirmationError); |
46 | 46 | } |
47 | 47 | |
48 | - if (!empty($errors['name'])) { |
|
48 | + if (!empty($errors[ 'name' ])) { |
|
49 | 49 | $nameError = [ |
50 | 50 | 'status' => $statusCode, |
51 | 51 | 'title' => 'Name error', |
52 | - 'detail' => $errors['name'][0] |
|
52 | + 'detail' => $errors[ 'name' ][ 0 ] |
|
53 | 53 | ]; |
54 | 54 | array_push($errorsJson, $nameError); |
55 | 55 | } |
56 | 56 | |
57 | - if (!empty($errors['token'])) { |
|
57 | + if (!empty($errors[ 'token' ])) { |
|
58 | 58 | $tokenError = [ |
59 | 59 | 'status' => $statusCode, |
60 | 60 | 'title' => 'Token error', |
61 | - 'detail' => $errors['token'] |
|
61 | + 'detail' => $errors[ 'token' ] |
|
62 | 62 | ]; |
63 | 63 | array_push($errorsJson, $tokenError); |
64 | 64 | } |
65 | 65 | |
66 | - if (!empty($errors['token'])) { |
|
66 | + if (!empty($errors[ 'token' ])) { |
|
67 | 67 | $tokenError = [ |
68 | 68 | 'status' => $statusCode, |
69 | 69 | 'title' => 'Token error', |
70 | - 'detail' => $errors['token'] |
|
70 | + 'detail' => $errors[ 'token' ] |
|
71 | 71 | ]; |
72 | 72 | array_push($errorsJson, $tokenError); |
73 | 73 | } |
74 | 74 | |
75 | - if (!empty($errors['activation_hash'])) { |
|
75 | + if (!empty($errors[ 'activation_hash' ])) { |
|
76 | 76 | $activationHashError = [ |
77 | 77 | 'status' => $statusCode, |
78 | 78 | 'title' => 'Activation hash error', |
79 | - 'detail' => $errors['activation_hash'][0] |
|
79 | + 'detail' => $errors[ 'activation_hash' ][ 0 ] |
|
80 | 80 | ]; |
81 | 81 | array_push($errorsJson, $activationHashError); |
82 | 82 | } |
@@ -96,6 +96,6 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function sendSuccessResponse() |
98 | 98 | { |
99 | - return response()->json([], self::HTTP_CODE_OK); |
|
99 | + return response()->json([ ], self::HTTP_CODE_OK); |
|
100 | 100 | } |
101 | 101 | } |
@@ -104,8 +104,8 @@ |
||
104 | 104 | { |
105 | 105 | return Mail::send( |
106 | 106 | $this->activationEmailTemplate, |
107 | - ['hash' => $hash], |
|
108 | - function ($message) use ($user) { |
|
107 | + [ 'hash' => $hash ], |
|
108 | + function($message) use ($user) { |
|
109 | 109 | $message->to($user->email, $user->usename)->subject('Laravel api boilerplate'); |
110 | 110 | } |
111 | 111 | ); |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | |
34 | 34 | Mail::send( |
35 | 35 | $this->remindPasswordEmailTemplate, |
36 | - ['hash' => $token, 'email' => $email], |
|
37 | - function ($message) use ($user) { |
|
36 | + [ 'hash' => $token, 'email' => $email ], |
|
37 | + function($message) use ($user) { |
|
38 | 38 | $message->to($user->email, $user->usename)->subject('Laravel api boilerplate'); |
39 | 39 | } |
40 | 40 | ); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $user = Auth::user(); |
56 | 56 | |
57 | 57 | if (Hash::check($request->get('current_password'), $user->password)) { |
58 | - $user->password = Hash::make($request['password']); |
|
58 | + $user->password = Hash::make($request[ 'password' ]); |
|
59 | 59 | $user->save(); |
60 | 60 | |
61 | 61 | return true; |
@@ -169,7 +169,7 @@ |
||
169 | 169 | |
170 | 170 | if (file_exists(app_path('JsonApi'))) { |
171 | 171 | if(!@rmdir(app_path('JsonApi'))) { |
172 | - throw new \League\Flysystem\Exception('JsonApi directory is not empty!'); |
|
172 | + throw new \League\Flysystem\Exception('JsonApi directory is not empty!'); |
|
173 | 173 | }; |
174 | 174 | } |
175 | 175 | } catch (\League\Flysystem\Exception $e) { |
@@ -122,19 +122,19 @@ discard block |
||
122 | 122 | protected function setupTest() |
123 | 123 | { |
124 | 124 | foreach ($this->migrations as $key => $value) { |
125 | - $this->migrations[$key] = $value . $this->testPostfix; |
|
125 | + $this->migrations[ $key ] = $value . $this->testPostfix; |
|
126 | 126 | } |
127 | 127 | foreach ($this->seeds as $key => $value) { |
128 | - $this->seeds[$key] = $value . $this->testPostfix; |
|
128 | + $this->seeds[ $key ] = $value . $this->testPostfix; |
|
129 | 129 | } |
130 | 130 | foreach ($this->controllers as $key => $value) { |
131 | - $this->controllers[$key] = $value . $this->testPostfix; |
|
131 | + $this->controllers[ $key ] = $value . $this->testPostfix; |
|
132 | 132 | } |
133 | 133 | foreach ($this->models as $key => $value) { |
134 | - $this->models[$key] = $value . $this->testPostfix; |
|
134 | + $this->models[ $key ] = $value . $this->testPostfix; |
|
135 | 135 | } |
136 | 136 | foreach ($this->jsonapiEntities as $key => $value) { |
137 | - $this->jsonapiEntities[$key] = $value . $this->testPostfix; |
|
137 | + $this->jsonapiEntities[ $key ] = $value . $this->testPostfix; |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | foreach ($this->migrations as $key => $value) { |
171 | 171 | $mask = database_path('migrations/*' . $value); |
172 | - array_map( "unlink", glob( $mask ) ); |
|
172 | + array_map("unlink", glob($mask)); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | if (file_exists(app_path('JsonApi'))) { |
216 | - if(!@rmdir(app_path('JsonApi'))) { |
|
216 | + if (!@rmdir(app_path('JsonApi'))) { |
|
217 | 217 | throw new \League\Flysystem\Exception('JsonApi directory is not empty!'); |
218 | 218 | }; |
219 | 219 | } |
@@ -126,19 +126,19 @@ discard block |
||
126 | 126 | protected function setupTest() |
127 | 127 | { |
128 | 128 | foreach ($this->migrations as $key => $value) { |
129 | - $this->migrations[$key] = $value . $this->testPostfix; |
|
129 | + $this->migrations[ $key ] = $value . $this->testPostfix; |
|
130 | 130 | } |
131 | 131 | foreach ($this->seeds as $key => $value) { |
132 | - $this->seeds[$key] = $value . $this->testPostfix; |
|
132 | + $this->seeds[ $key ] = $value . $this->testPostfix; |
|
133 | 133 | } |
134 | 134 | foreach ($this->controllers as $key => $value) { |
135 | - $this->controllers[$key] = $value . $this->testPostfix; |
|
135 | + $this->controllers[ $key ] = $value . $this->testPostfix; |
|
136 | 136 | } |
137 | 137 | foreach ($this->models as $key => $value) { |
138 | - $this->models[$key] = $value . $this->testPostfix; |
|
138 | + $this->models[ $key ] = $value . $this->testPostfix; |
|
139 | 139 | } |
140 | 140 | foreach ($this->jsonapiEntities as $key => $value) { |
141 | - $this->jsonapiEntities[$key] = $value . $this->testPostfix; |
|
141 | + $this->jsonapiEntities[ $key ] = $value . $this->testPostfix; |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
@@ -177,14 +177,14 @@ discard block |
||
177 | 177 | protected function copyJsonApiEntities() |
178 | 178 | { |
179 | 179 | foreach ($this->jsonapiEntities as $key => $value) { |
180 | - if (file_exists(app_path('JsonApi/'.$value)) && ! $this->option('force')) { |
|
181 | - if (! $this->confirm("The [{$value}] already exists. Do you want to replace it?")) { |
|
180 | + if (file_exists(app_path('JsonApi/' . $value)) && !$this->option('force')) { |
|
181 | + if (!$this->confirm("The [{$value}] already exists. Do you want to replace it?")) { |
|
182 | 182 | continue; |
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
186 | 186 | copy( |
187 | - base_path('stubs/'.$key), |
|
187 | + base_path('stubs/' . $key), |
|
188 | 188 | app_path($value) |
189 | 189 | ); |
190 | 190 | } |
@@ -196,15 +196,15 @@ discard block |
||
196 | 196 | protected function exportControllers() |
197 | 197 | { |
198 | 198 | foreach ($this->controllers as $key => $value) { |
199 | - if (file_exists(app_path('Http/Controllers/Api/v1/'.$value)) && ! $this->option('force')) { |
|
200 | - if (! $this->confirm("The [{$value}] already exists. Do you want to replace it?")) { |
|
199 | + if (file_exists(app_path('Http/Controllers/Api/v1/' . $value)) && !$this->option('force')) { |
|
200 | + if (!$this->confirm("The [{$value}] already exists. Do you want to replace it?")) { |
|
201 | 201 | continue; |
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
205 | 205 | copy( |
206 | - base_path('stubs/Controllers/'.$key), |
|
207 | - app_path('Http/Controllers/Api/v1/'.$value) |
|
206 | + base_path('stubs/Controllers/' . $key), |
|
207 | + app_path('Http/Controllers/Api/v1/' . $value) |
|
208 | 208 | ); |
209 | 209 | } |
210 | 210 | } |
@@ -215,15 +215,15 @@ discard block |
||
215 | 215 | protected function exportModels() |
216 | 216 | { |
217 | 217 | foreach ($this->models as $key => $value) { |
218 | - if (file_exists(app_path('Models/'.$value)) && ! $this->option('force')) { |
|
219 | - if (! $this->confirm("The [{$value}] model already exists. Do you want to replace it?")) { |
|
218 | + if (file_exists(app_path('Models/' . $value)) && !$this->option('force')) { |
|
219 | + if (!$this->confirm("The [{$value}] model already exists. Do you want to replace it?")) { |
|
220 | 220 | continue; |
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
224 | 224 | copy( |
225 | - base_path('stubs/Models/'.$key), |
|
226 | - app_path('Models/'.$value) |
|
225 | + base_path('stubs/Models/' . $key), |
|
226 | + app_path('Models/' . $value) |
|
227 | 227 | ); |
228 | 228 | } |
229 | 229 | } |
@@ -235,15 +235,15 @@ discard block |
||
235 | 235 | { |
236 | 236 | $counter = 0; |
237 | 237 | foreach ($this->migrations as $key => $value) { |
238 | - if (file_exists(database_path('migrations/'.$value)) && ! $this->option('force')) { |
|
239 | - if (! $this->confirm("The [{$value}] migration already exists. Do you want to replace it?")) { |
|
238 | + if (file_exists(database_path('migrations/' . $value)) && !$this->option('force')) { |
|
239 | + if (!$this->confirm("The [{$value}] migration already exists. Do you want to replace it?")) { |
|
240 | 240 | continue; |
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
244 | 244 | copy( |
245 | 245 | base_path('stubs/migrations/' . $key), |
246 | - database_path('migrations/'. date('Y_m_d_Hi') . '0' . $counter++ . '_' . $value) |
|
246 | + database_path('migrations/' . date('Y_m_d_Hi') . '0' . $counter++ . '_' . $value) |
|
247 | 247 | ); |
248 | 248 | } |
249 | 249 | } |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | protected function exportSeeds() |
255 | 255 | { |
256 | 256 | foreach ($this->seeds as $key => $value) { |
257 | - if (file_exists(database_path('seeds/'.$value)) && ! $this->option('force')) { |
|
258 | - if (! $this->confirm("The [{$value}] already exists. Do you want to replace it?")) { |
|
257 | + if (file_exists(database_path('seeds/' . $value)) && !$this->option('force')) { |
|
258 | + if (!$this->confirm("The [{$value}] already exists. Do you want to replace it?")) { |
|
259 | 259 | continue; |
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | 263 | copy( |
264 | - base_path('stubs/seeds/'.$key), |
|
265 | - database_path('seeds/'.$value) |
|
264 | + base_path('stubs/seeds/' . $key), |
|
265 | + database_path('seeds/' . $value) |
|
266 | 266 | ); |
267 | 267 | } |
268 | 268 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @param $src |
272 | 272 | * @param $dst |
273 | 273 | */ |
274 | - protected function recurse_copy($src,$dst) |
|
274 | + protected function recurse_copy($src, $dst) |
|
275 | 275 | { |
276 | 276 | $dir = opendir($src); |
277 | 277 | @mkdir($dst); |
@@ -3,8 +3,6 @@ |
||
3 | 3 | namespace App\Console\Commands; |
4 | 4 | |
5 | 5 | use Illuminate\Console\Command; |
6 | -use Symfony\Component\Console\Input\InputInterface; |
|
7 | -use Symfony\Component\Console\Output\OutputInterface; |
|
8 | 6 | |
9 | 7 | |
10 | 8 | class MakeJsonApiDemo extends Command |