|
@@ -169,7 +169,7 @@ discard block |
|
|
block discarded – undo |
169
|
169
|
|
170
|
170
|
|
171
|
171
|
|
172
|
|
- $modelTableContent = file_get_contents(__DIR__ . '/../Migration/modelTable.stub'); |
|
172
|
+ $modelTableContent = file_get_contents(__DIR__.'/../Migration/modelTable.stub'); |
173
|
173
|
$modelTableContentNew = str_replace([ |
174
|
174
|
'{{$namePlural}}', |
175
|
175
|
'{{$nameSmallPlural}}', |
|
@@ -179,7 +179,7 @@ discard block |
|
|
block discarded – undo |
179
|
179
|
], $modelTableContent); |
180
|
180
|
|
181
|
181
|
|
182
|
|
- $modelResetPasswordTableContent = file_get_contents(__DIR__ . '/../Migration/passwordResetsTable.stub'); |
|
182
|
+ $modelResetPasswordTableContent = file_get_contents(__DIR__.'/../Migration/passwordResetsTable.stub'); |
183
|
183
|
$modelResetPasswordTableContentNew = str_replace([ |
184
|
184
|
'{{$namePlural}}', |
185
|
185
|
'{{$nameSmallPlural}}', |
|
@@ -189,12 +189,12 @@ discard block |
|
|
block discarded – undo |
189
|
189
|
], $modelResetPasswordTableContent); |
190
|
190
|
|
191
|
191
|
|
192
|
|
- $migrationName = date('Y_m_d_His') . '_'.'create_' . str_plural(snake_case($name)) .'_table.php'; |
|
192
|
+ $migrationName = date('Y_m_d_His').'_'.'create_'.str_plural(snake_case($name)).'_table.php'; |
193
|
193
|
$migrationModelPath = $this->getMigrationPath().DIRECTORY_SEPARATOR.$migrationName; |
194
|
194
|
file_put_contents($migrationModelPath, $modelTableContentNew); |
195
|
195
|
|
196
|
|
- $migrationResetName = date('Y_m_d_His') . '_' |
197
|
|
- .'create_' . str_plural(snake_case($name)) |
|
196
|
+ $migrationResetName = date('Y_m_d_His').'_' |
|
197
|
+ .'create_'.str_plural(snake_case($name)) |
198
|
198
|
.'_password_resets_table.php'; |
199
|
199
|
$migrationResetModelPath = $this->getMigrationPath().DIRECTORY_SEPARATOR.$migrationResetName; |
200
|
200
|
file_put_contents($migrationResetModelPath, $modelResetPasswordTableContentNew); |
|
@@ -228,7 +228,7 @@ discard block |
|
|
block discarded – undo |
228
|
228
|
array_push($newChanges, $nameSmallPlural); |
229
|
229
|
array_push($newChanges, $nameSmall); |
230
|
230
|
|
231
|
|
- $modelContent = file_get_contents(__DIR__ . '/../Backpack/Model/model.stub'); |
|
231
|
+ $modelContent = file_get_contents(__DIR__.'/../Backpack/Model/model.stub'); |
232
|
232
|
$modelContentNew = str_replace($arrayToChange, $newChanges, $modelContent); |
233
|
233
|
|
234
|
234
|
$createFolder = $this->getAppFolderPath().DIRECTORY_SEPARATOR."Models"; |
|
@@ -241,7 +241,7 @@ discard block |
|
|
block discarded – undo |
241
|
241
|
|
242
|
242
|
|
243
|
243
|
|
244
|
|
- $resetNotificationContent = file_get_contents(__DIR__ . '/../Notification/resetPasswordNotification.stub'); |
|
244
|
+ $resetNotificationContent = file_get_contents(__DIR__.'/../Notification/resetPasswordNotification.stub'); |
245
|
245
|
$resetNotificationContentNew = str_replace([ |
246
|
246
|
'{{$name}}', |
247
|
247
|
'{{$nameSmall}}', |
|
@@ -250,7 +250,7 @@ discard block |
|
|
block discarded – undo |
250
|
250
|
$nameSmall |
251
|
251
|
], $resetNotificationContent); |
252
|
252
|
|
253
|
|
- $verifyEmailContent = file_get_contents(__DIR__ . '/../Notification/verifyEmailNotification.stub'); |
|
253
|
+ $verifyEmailContent = file_get_contents(__DIR__.'/../Notification/verifyEmailNotification.stub'); |
254
|
254
|
$verifyEmailContentNew = str_replace([ |
255
|
255
|
'{{$name}}', |
256
|
256
|
'{{$nameSmall}}', |
|
@@ -286,20 +286,20 @@ discard block |
|
|
block discarded – undo |
286
|
286
|
$name = ucfirst($this->getParsedNameInput()); |
287
|
287
|
|
288
|
288
|
// layouts |
289
|
|
- $appBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/layouts/layout.blade.stub'); |
290
|
|
- $appGuestBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/layouts/layout_guest.blade.stub'); |
|
289
|
+ $appBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/layouts/layout.blade.stub'); |
|
290
|
+ $appGuestBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/layouts/layout_guest.blade.stub'); |
291
|
291
|
|
292
|
292
|
// home |
293
|
|
- $homeBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/home.blade.stub'); |
|
293
|
+ $homeBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/home.blade.stub'); |
294
|
294
|
|
295
|
295
|
// auth |
296
|
|
- $loginBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/login.blade.stub'); |
297
|
|
- $registerBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/register.blade.stub'); |
298
|
|
- $verifyEmailBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/verify.blade.stub'); |
|
296
|
+ $loginBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/login.blade.stub'); |
|
297
|
+ $registerBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/register.blade.stub'); |
|
298
|
+ $verifyEmailBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/verify.blade.stub'); |
299
|
299
|
|
300
|
300
|
// auth/passwords |
301
|
|
- $resetBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/passwords/reset.blade.stub'); |
302
|
|
- $emailBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/passwords/email.blade.stub'); |
|
301
|
+ $resetBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/passwords/reset.blade.stub'); |
|
302
|
+ $emailBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/passwords/email.blade.stub'); |
303
|
303
|
|
304
|
304
|
// auth/account |
305
|
305
|
$update_infoBlade = file_get_contents(__DIR__ |
|
@@ -554,10 +554,10 @@ discard block |
|
|
block discarded – undo |
554
|
554
|
{ |
555
|
555
|
$nameSmall = snake_case($this->getParsedNameInput()); |
556
|
556
|
$name = ucfirst($this->getParsedNameInput()); |
557
|
|
- $mapCallFunction = file_get_contents(__DIR__ . '/../Route/mapRoute.stub'); |
|
557
|
+ $mapCallFunction = file_get_contents(__DIR__.'/../Route/mapRoute.stub'); |
558
|
558
|
$mapCallFunctionNew = str_replace('{{$name}}', "$name", $mapCallFunction); |
559
|
559
|
$this->insert($this->getRouteServicesPath(), '$this->mapWebRoutes();', $mapCallFunctionNew, true); |
560
|
|
- $mapFunction = file_get_contents(__DIR__ . '/../Route/mapRouteFunction.stub'); |
|
560
|
+ $mapFunction = file_get_contents(__DIR__.'/../Route/mapRouteFunction.stub'); |
561
|
561
|
$mapFunctionNew = str_replace([ |
562
|
562
|
'{{$name}}', |
563
|
563
|
'{{$nameSmall}}' |
|
@@ -575,7 +575,7 @@ discard block |
|
|
block discarded – undo |
575
|
575
|
|
576
|
576
|
$routeServicesContent = file_get_contents($this->getRouteServicesPath()); |
577
|
577
|
|
578
|
|
- if (str_contains($routeServicesContent,'$this->map'.$name.'Routes();')) { |
|
578
|
+ if (str_contains($routeServicesContent, '$this->map'.$name.'Routes();')) { |
579
|
579
|
return true; |
580
|
580
|
} |
581
|
581
|
return false; |
|
@@ -595,7 +595,7 @@ discard block |
|
|
block discarded – undo |
595
|
595
|
if (!file_exists($createFolder)) { |
596
|
596
|
mkdir($createFolder); |
597
|
597
|
} |
598
|
|
- $routeFileContent = file_get_contents(__DIR__ . '/../Route/routeFile.stub'); |
|
598
|
+ $routeFileContent = file_get_contents(__DIR__.'/../Route/routeFile.stub'); |
599
|
599
|
$routeFileContentNew = str_replace([ |
600
|
600
|
'{{$name}}', |
601
|
601
|
'{{$nameSmall}}' |
|
@@ -628,8 +628,8 @@ discard block |
|
|
block discarded – undo |
628
|
628
|
if (!file_exists($requestsFolder)) { |
629
|
629
|
mkdir($requestsFolder); |
630
|
630
|
} |
631
|
|
- $accountInfoContent = file_get_contents(__DIR__ . '/../Request/AccountInfoRequest.stub'); |
632
|
|
- $changePasswordContent = file_get_contents(__DIR__ . '/../Request/ChangePasswordRequest.stub'); |
|
631
|
+ $accountInfoContent = file_get_contents(__DIR__.'/../Request/AccountInfoRequest.stub'); |
|
632
|
+ $changePasswordContent = file_get_contents(__DIR__.'/../Request/ChangePasswordRequest.stub'); |
633
|
633
|
|
634
|
634
|
$accountInfoContentNew = str_replace([ |
635
|
635
|
'{{$name}}', |
|
@@ -678,14 +678,14 @@ discard block |
|
|
block discarded – undo |
678
|
678
|
mkdir($authFolder); |
679
|
679
|
} |
680
|
680
|
|
681
|
|
- $controllerContent = file_get_contents(__DIR__ . '/../Controllers/Controller.stub'); |
682
|
|
- $homeControllerContent = file_get_contents(__DIR__ . '/../Controllers/HomeController.stub'); |
683
|
|
- $loginControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/LoginController.stub'); |
684
|
|
- $forgotControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/ForgotPasswordController.stub'); |
685
|
|
- $registerControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/RegisterController.stub'); |
686
|
|
- $resetControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/ResetPasswordController.stub'); |
687
|
|
- $myAccountControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/MyAccountController.stub'); |
688
|
|
- $verificationControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/VerificationController.stub'); |
|
681
|
+ $controllerContent = file_get_contents(__DIR__.'/../Controllers/Controller.stub'); |
|
682
|
+ $homeControllerContent = file_get_contents(__DIR__.'/../Controllers/HomeController.stub'); |
|
683
|
+ $loginControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/LoginController.stub'); |
|
684
|
+ $forgotControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/ForgotPasswordController.stub'); |
|
685
|
+ $registerControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/RegisterController.stub'); |
|
686
|
+ $resetControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/ResetPasswordController.stub'); |
|
687
|
+ $myAccountControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/MyAccountController.stub'); |
|
688
|
+ $verificationControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/VerificationController.stub'); |
689
|
689
|
|
690
|
690
|
$controllerFileContentNew = str_replace('{{$name}}', "$name", $controllerContent); |
691
|
691
|
|
|
@@ -789,9 +789,9 @@ discard block |
|
|
block discarded – undo |
789
|
789
|
|
790
|
790
|
$authConfigFile = $this->getConfigsFolderPath().DIRECTORY_SEPARATOR."auth.php"; |
791
|
791
|
|
792
|
|
- $guardContent = file_get_contents(__DIR__ . '/../Config/guard.stub'); |
793
|
|
- $passwordContent = file_get_contents(__DIR__ . '/../Config/password.stub'); |
794
|
|
- $providerContent = file_get_contents(__DIR__ . '/../Config/provider.stub'); |
|
792
|
+ $guardContent = file_get_contents(__DIR__.'/../Config/guard.stub'); |
|
793
|
+ $passwordContent = file_get_contents(__DIR__.'/../Config/password.stub'); |
|
794
|
+ $providerContent = file_get_contents(__DIR__.'/../Config/provider.stub'); |
795
|
795
|
|
796
|
796
|
$guardFileContentNew = str_replace([ |
797
|
797
|
'{{$nameSmall}}', |
|
@@ -832,7 +832,7 @@ discard block |
|
|
block discarded – undo |
832
|
832
|
$exceptionHandlerFile = $this->getAppFolderPath().DIRECTORY_SEPARATOR."Exceptions".DIRECTORY_SEPARATOR |
833
|
833
|
."Handler.php"; |
834
|
834
|
$exceptionHandlerFileContent = file_get_contents($exceptionHandlerFile); |
835
|
|
- $exceptionHandlerFileContentNew = file_get_contents(__DIR__ . '/../Exceptions/handlerUnauthorized.stub'); |
|
835
|
+ $exceptionHandlerFileContentNew = file_get_contents(__DIR__.'/../Exceptions/handlerUnauthorized.stub'); |
836
|
836
|
|
837
|
837
|
|
838
|
838
|
if (!str_contains($exceptionHandlerFileContent, 'MultiAuthUnAuthenticated')) { |
|
@@ -843,7 +843,7 @@ discard block |
|
|
block discarded – undo |
843
|
843
|
} |
844
|
844
|
} |
845
|
845
|
|
846
|
|
- $exceptionHandlerGuardContentNew = file_get_contents(__DIR__ . '/../Exceptions/handlerGuard.stub'); |
|
846
|
+ $exceptionHandlerGuardContentNew = file_get_contents(__DIR__.'/../Exceptions/handlerGuard.stub'); |
847
|
847
|
$exceptionHandlerGuardContentNew2 = str_replace('{{$nameSmall}}', "$nameSmall", |
848
|
848
|
$exceptionHandlerGuardContentNew); |
849
|
849
|
|
|
@@ -872,9 +872,9 @@ discard block |
|
|
block discarded – undo |
872
|
872
|
$redirectIfMiddlewareFileContent = file_get_contents($redirectIfMiddlewareFile); |
873
|
873
|
$authenticateMiddlewareFileContent = file_get_contents($redirectIfMiddlewareFile); |
874
|
874
|
|
875
|
|
- $ensureEmailIsVerifiedMiddlewareFileeContent = file_get_contents(__DIR__ . '/../Middleware/ensureEmailIsVerified.stub'); |
876
|
|
- $redirectIfMiddlewareContentNew = file_get_contents(__DIR__ . '/../Middleware/redirectIf.stub'); |
877
|
|
- $authenticateMiddlewareContentNew = file_get_contents(__DIR__ . '/../Middleware/authenticate.stub'); |
|
875
|
+ $ensureEmailIsVerifiedMiddlewareFileeContent = file_get_contents(__DIR__.'/../Middleware/ensureEmailIsVerified.stub'); |
|
876
|
+ $redirectIfMiddlewareContentNew = file_get_contents(__DIR__.'/../Middleware/redirectIf.stub'); |
|
877
|
+ $authenticateMiddlewareContentNew = file_get_contents(__DIR__.'/../Middleware/authenticate.stub'); |
878
|
878
|
|
879
|
879
|
if (!file_exists($ensureEmailIsVerifiedMiddlewareFile)) { |
880
|
880
|
file_put_contents($ensureEmailIsVerifiedMiddlewareFile, $ensureEmailIsVerifiedMiddlewareFileeContent); |
|
@@ -896,9 +896,9 @@ discard block |
|
|
block discarded – undo |
896
|
896
|
} |
897
|
897
|
} |
898
|
898
|
|
899
|
|
- $redirectIfMiddlewareGroupContentNew = file_get_contents(__DIR__ . '/../Middleware/redirectMiddleware.stub'); |
900
|
|
- $redirectIfMiddlewareGuardContentNew = file_get_contents(__DIR__ . '/../Middleware/redirectMiddlewareGuard.stub'); |
901
|
|
- $authenticateIfMiddlewareGuardContentNew = file_get_contents(__DIR__ . '/../Middleware/authenticateIf.stub'); |
|
899
|
+ $redirectIfMiddlewareGroupContentNew = file_get_contents(__DIR__.'/../Middleware/redirectMiddleware.stub'); |
|
900
|
+ $redirectIfMiddlewareGuardContentNew = file_get_contents(__DIR__.'/../Middleware/redirectMiddlewareGuard.stub'); |
|
901
|
+ $authenticateIfMiddlewareGuardContentNew = file_get_contents(__DIR__.'/../Middleware/authenticateIf.stub'); |
902
|
902
|
|
903
|
903
|
$redirectIfMiddlewareGroupContentNew2 = str_replace('{{$nameSmall}}', "$nameSmall", |
904
|
904
|
$redirectIfMiddlewareGroupContentNew); |
|
@@ -937,7 +937,7 @@ discard block |
|
|
block discarded – undo |
937
|
937
|
$this->info('### Running: '.$command); |
938
|
938
|
} |
939
|
939
|
$process = new Process($command); |
940
|
|
- $process->run(function ($type, $buffer) { |
|
940
|
+ $process->run(function($type, $buffer) { |
941
|
941
|
if (Process::ERR === $type) { |
942
|
942
|
echo '... > '.$buffer; |
943
|
943
|
} else { |
|
@@ -1090,7 +1090,7 @@ discard block |
|
|
block discarded – undo |
1090
|
1090
|
*/ |
1091
|
1091
|
public function insertIntoFile($filePath, $insertMarker, $text, $after = true) { |
1092
|
1092
|
$contents = file_get_contents($filePath); |
1093
|
|
- $new_contents = preg_replace($insertMarker,($after) ? '$0' . $text : $text . '$0', $contents); |
|
1093
|
+ $new_contents = preg_replace($insertMarker, ($after) ? '$0'.$text : $text.'$0', $contents); |
1094
|
1094
|
return file_put_contents($filePath, $new_contents); |
1095
|
1095
|
} |
1096
|
1096
|
|
|
@@ -1107,7 +1107,7 @@ discard block |
|
|
block discarded – undo |
1107
|
1107
|
public function insert($filePath, $keyword, $body, $after = true) { |
1108
|
1108
|
|
1109
|
1109
|
$contents = file_get_contents($filePath); |
1110
|
|
- $new_contents = substr_replace($contents, PHP_EOL . $body, |
|
1110
|
+ $new_contents = substr_replace($contents, PHP_EOL.$body, |
1111
|
1111
|
($after) ? strpos($contents, $keyword) + strlen($keyword) : strpos($contents, $keyword) |
1112
|
1112
|
, 0); |
1113
|
1113
|
return file_put_contents($filePath, $new_contents); |