|
@@ -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}}', |
|
@@ -282,25 +282,25 @@ discard block |
|
|
block discarded – undo |
282
|
282
|
*/ |
283
|
283
|
public function installView($theme_name = 'adminlte') |
284
|
284
|
{ |
285
|
|
- if (file_exists(__DIR__ . '/../Backpack/Views/'.$theme_name)) { |
|
285
|
+ if (file_exists(__DIR__.'/../Backpack/Views/'.$theme_name)) { |
286
|
286
|
$nameSmall = snake_case($this->getParsedNameInput()); |
287
|
287
|
$name = ucfirst($this->getParsedNameInput()); |
288
|
288
|
|
289
|
289
|
// layouts |
290
|
|
- $appBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/layouts/layout.blade.stub'); |
291
|
|
- $appGuestBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/layouts/layout_guest.blade.stub'); |
|
290
|
+ $appBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/layouts/layout.blade.stub'); |
|
291
|
+ $appGuestBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/layouts/layout_guest.blade.stub'); |
292
|
292
|
|
293
|
293
|
// home |
294
|
|
- $homeBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/home.blade.stub'); |
|
294
|
+ $homeBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/home.blade.stub'); |
295
|
295
|
|
296
|
296
|
// auth |
297
|
|
- $loginBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/login.blade.stub'); |
298
|
|
- $registerBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/register.blade.stub'); |
299
|
|
- $verifyEmailBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/verify.blade.stub'); |
|
297
|
+ $loginBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/login.blade.stub'); |
|
298
|
+ $registerBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/register.blade.stub'); |
|
299
|
+ $verifyEmailBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/verify.blade.stub'); |
300
|
300
|
|
301
|
301
|
// auth/passwords |
302
|
|
- $resetBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/passwords/reset.blade.stub'); |
303
|
|
- $emailBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/passwords/email.blade.stub'); |
|
302
|
+ $resetBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/passwords/reset.blade.stub'); |
|
303
|
+ $emailBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/passwords/email.blade.stub'); |
304
|
304
|
|
305
|
305
|
// auth/account |
306
|
306
|
$update_infoBlade = file_get_contents(__DIR__ |
|
@@ -557,10 +557,10 @@ discard block |
|
|
block discarded – undo |
557
|
557
|
{ |
558
|
558
|
$nameSmall = snake_case($this->getParsedNameInput()); |
559
|
559
|
$name = ucfirst($this->getParsedNameInput()); |
560
|
|
- $mapCallFunction = file_get_contents(__DIR__ . '/../Route/mapRoute.stub'); |
|
560
|
+ $mapCallFunction = file_get_contents(__DIR__.'/../Route/mapRoute.stub'); |
561
|
561
|
$mapCallFunctionNew = str_replace('{{$name}}', "$name", $mapCallFunction); |
562
|
562
|
$this->insert($this->getRouteServicesPath(), '$this->mapWebRoutes();', $mapCallFunctionNew, true); |
563
|
|
- $mapFunction = file_get_contents(__DIR__ . '/../Route/mapRouteFunction.stub'); |
|
563
|
+ $mapFunction = file_get_contents(__DIR__.'/../Route/mapRouteFunction.stub'); |
564
|
564
|
$mapFunctionNew = str_replace([ |
565
|
565
|
'{{$name}}', |
566
|
566
|
'{{$nameSmall}}' |
|
@@ -578,7 +578,7 @@ discard block |
|
|
block discarded – undo |
578
|
578
|
|
579
|
579
|
$routeServicesContent = file_get_contents($this->getRouteServicesPath()); |
580
|
580
|
|
581
|
|
- if (str_contains($routeServicesContent,'$this->map'.$name.'Routes();')) { |
|
581
|
+ if (str_contains($routeServicesContent, '$this->map'.$name.'Routes();')) { |
582
|
582
|
return true; |
583
|
583
|
} |
584
|
584
|
return false; |
|
@@ -598,7 +598,7 @@ discard block |
|
|
block discarded – undo |
598
|
598
|
if (!file_exists($createFolder)) { |
599
|
599
|
mkdir($createFolder); |
600
|
600
|
} |
601
|
|
- $routeFileContent = file_get_contents(__DIR__ . '/../Route/routeFile.stub'); |
|
601
|
+ $routeFileContent = file_get_contents(__DIR__.'/../Route/routeFile.stub'); |
602
|
602
|
$routeFileContentNew = str_replace([ |
603
|
603
|
'{{$name}}', |
604
|
604
|
'{{$nameSmall}}' |
|
@@ -631,8 +631,8 @@ discard block |
|
|
block discarded – undo |
631
|
631
|
if (!file_exists($requestsFolder)) { |
632
|
632
|
mkdir($requestsFolder); |
633
|
633
|
} |
634
|
|
- $accountInfoContent = file_get_contents(__DIR__ . '/../Request/AccountInfoRequest.stub'); |
635
|
|
- $changePasswordContent = file_get_contents(__DIR__ . '/../Request/ChangePasswordRequest.stub'); |
|
634
|
+ $accountInfoContent = file_get_contents(__DIR__.'/../Request/AccountInfoRequest.stub'); |
|
635
|
+ $changePasswordContent = file_get_contents(__DIR__.'/../Request/ChangePasswordRequest.stub'); |
636
|
636
|
|
637
|
637
|
$accountInfoContentNew = str_replace([ |
638
|
638
|
'{{$name}}', |
|
@@ -681,14 +681,14 @@ discard block |
|
|
block discarded – undo |
681
|
681
|
mkdir($authFolder); |
682
|
682
|
} |
683
|
683
|
|
684
|
|
- $controllerContent = file_get_contents(__DIR__ . '/../Controllers/Controller.stub'); |
685
|
|
- $homeControllerContent = file_get_contents(__DIR__ . '/../Controllers/HomeController.stub'); |
686
|
|
- $loginControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/LoginController.stub'); |
687
|
|
- $forgotControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/ForgotPasswordController.stub'); |
688
|
|
- $registerControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/RegisterController.stub'); |
689
|
|
- $resetControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/ResetPasswordController.stub'); |
690
|
|
- $myAccountControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/MyAccountController.stub'); |
691
|
|
- $verificationControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/VerificationController.stub'); |
|
684
|
+ $controllerContent = file_get_contents(__DIR__.'/../Controllers/Controller.stub'); |
|
685
|
+ $homeControllerContent = file_get_contents(__DIR__.'/../Controllers/HomeController.stub'); |
|
686
|
+ $loginControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/LoginController.stub'); |
|
687
|
+ $forgotControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/ForgotPasswordController.stub'); |
|
688
|
+ $registerControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/RegisterController.stub'); |
|
689
|
+ $resetControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/ResetPasswordController.stub'); |
|
690
|
+ $myAccountControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/MyAccountController.stub'); |
|
691
|
+ $verificationControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/VerificationController.stub'); |
692
|
692
|
|
693
|
693
|
$controllerFileContentNew = str_replace('{{$name}}', "$name", $controllerContent); |
694
|
694
|
|
|
@@ -792,9 +792,9 @@ discard block |
|
|
block discarded – undo |
792
|
792
|
|
793
|
793
|
$authConfigFile = $this->getConfigsFolderPath().DIRECTORY_SEPARATOR."auth.php"; |
794
|
794
|
|
795
|
|
- $guardContent = file_get_contents(__DIR__ . '/../Config/guard.stub'); |
796
|
|
- $passwordContent = file_get_contents(__DIR__ . '/../Config/password.stub'); |
797
|
|
- $providerContent = file_get_contents(__DIR__ . '/../Config/provider.stub'); |
|
795
|
+ $guardContent = file_get_contents(__DIR__.'/../Config/guard.stub'); |
|
796
|
+ $passwordContent = file_get_contents(__DIR__.'/../Config/password.stub'); |
|
797
|
+ $providerContent = file_get_contents(__DIR__.'/../Config/provider.stub'); |
798
|
798
|
|
799
|
799
|
$guardFileContentNew = str_replace([ |
800
|
800
|
'{{$nameSmall}}', |
|
@@ -835,7 +835,7 @@ discard block |
|
|
block discarded – undo |
835
|
835
|
$exceptionHandlerFile = $this->getAppFolderPath().DIRECTORY_SEPARATOR."Exceptions".DIRECTORY_SEPARATOR |
836
|
836
|
."Handler.php"; |
837
|
837
|
$exceptionHandlerFileContent = file_get_contents($exceptionHandlerFile); |
838
|
|
- $exceptionHandlerFileContentNew = file_get_contents(__DIR__ . '/../Exceptions/handlerUnauthorized.stub'); |
|
838
|
+ $exceptionHandlerFileContentNew = file_get_contents(__DIR__.'/../Exceptions/handlerUnauthorized.stub'); |
839
|
839
|
|
840
|
840
|
|
841
|
841
|
if (!str_contains($exceptionHandlerFileContent, 'MultiAuthUnAuthenticated')) { |
|
@@ -846,7 +846,7 @@ discard block |
|
|
block discarded – undo |
846
|
846
|
} |
847
|
847
|
} |
848
|
848
|
|
849
|
|
- $exceptionHandlerGuardContentNew = file_get_contents(__DIR__ . '/../Exceptions/handlerGuard.stub'); |
|
849
|
+ $exceptionHandlerGuardContentNew = file_get_contents(__DIR__.'/../Exceptions/handlerGuard.stub'); |
850
|
850
|
$exceptionHandlerGuardContentNew2 = str_replace('{{$nameSmall}}', "$nameSmall", |
851
|
851
|
$exceptionHandlerGuardContentNew); |
852
|
852
|
|
|
@@ -875,9 +875,9 @@ discard block |
|
|
block discarded – undo |
875
|
875
|
$redirectIfMiddlewareFileContent = file_get_contents($redirectIfMiddlewareFile); |
876
|
876
|
$authenticateMiddlewareFileContent = file_get_contents($redirectIfMiddlewareFile); |
877
|
877
|
|
878
|
|
- $ensureEmailIsVerifiedMiddlewareFileeContent = file_get_contents(__DIR__ . '/../Middleware/ensureEmailIsVerified.stub'); |
879
|
|
- $redirectIfMiddlewareContentNew = file_get_contents(__DIR__ . '/../Middleware/redirectIf.stub'); |
880
|
|
- $authenticateMiddlewareContentNew = file_get_contents(__DIR__ . '/../Middleware/authenticate.stub'); |
|
878
|
+ $ensureEmailIsVerifiedMiddlewareFileeContent = file_get_contents(__DIR__.'/../Middleware/ensureEmailIsVerified.stub'); |
|
879
|
+ $redirectIfMiddlewareContentNew = file_get_contents(__DIR__.'/../Middleware/redirectIf.stub'); |
|
880
|
+ $authenticateMiddlewareContentNew = file_get_contents(__DIR__.'/../Middleware/authenticate.stub'); |
881
|
881
|
|
882
|
882
|
if (!file_exists($ensureEmailIsVerifiedMiddlewareFile)) { |
883
|
883
|
file_put_contents($ensureEmailIsVerifiedMiddlewareFile, $ensureEmailIsVerifiedMiddlewareFileeContent); |
|
@@ -899,9 +899,9 @@ discard block |
|
|
block discarded – undo |
899
|
899
|
} |
900
|
900
|
} |
901
|
901
|
|
902
|
|
- $redirectIfMiddlewareGroupContentNew = file_get_contents(__DIR__ . '/../Middleware/redirectMiddleware.stub'); |
903
|
|
- $redirectIfMiddlewareGuardContentNew = file_get_contents(__DIR__ . '/../Middleware/redirectMiddlewareGuard.stub'); |
904
|
|
- $authenticateIfMiddlewareGuardContentNew = file_get_contents(__DIR__ . '/../Middleware/authenticateIf.stub'); |
|
902
|
+ $redirectIfMiddlewareGroupContentNew = file_get_contents(__DIR__.'/../Middleware/redirectMiddleware.stub'); |
|
903
|
+ $redirectIfMiddlewareGuardContentNew = file_get_contents(__DIR__.'/../Middleware/redirectMiddlewareGuard.stub'); |
|
904
|
+ $authenticateIfMiddlewareGuardContentNew = file_get_contents(__DIR__.'/../Middleware/authenticateIf.stub'); |
905
|
905
|
|
906
|
906
|
$redirectIfMiddlewareGroupContentNew2 = str_replace('{{$nameSmall}}', "$nameSmall", |
907
|
907
|
$redirectIfMiddlewareGroupContentNew); |
|
@@ -940,7 +940,7 @@ discard block |
|
|
block discarded – undo |
940
|
940
|
$this->info('### Running: '.$command); |
941
|
941
|
} |
942
|
942
|
$process = new Process($command); |
943
|
|
- $process->run(function ($type, $buffer) { |
|
943
|
+ $process->run(function($type, $buffer) { |
944
|
944
|
if (Process::ERR === $type) { |
945
|
945
|
echo '... > '.$buffer; |
946
|
946
|
} else { |
|
@@ -1093,7 +1093,7 @@ discard block |
|
|
block discarded – undo |
1093
|
1093
|
*/ |
1094
|
1094
|
public function insertIntoFile($filePath, $insertMarker, $text, $after = true) { |
1095
|
1095
|
$contents = file_get_contents($filePath); |
1096
|
|
- $new_contents = preg_replace($insertMarker,($after) ? '$0' . $text : $text . '$0', $contents); |
|
1096
|
+ $new_contents = preg_replace($insertMarker, ($after) ? '$0'.$text : $text.'$0', $contents); |
1097
|
1097
|
return file_put_contents($filePath, $new_contents); |
1098
|
1098
|
} |
1099
|
1099
|
|
|
@@ -1110,7 +1110,7 @@ discard block |
|
|
block discarded – undo |
1110
|
1110
|
public function insert($filePath, $keyword, $body, $after = true) { |
1111
|
1111
|
|
1112
|
1112
|
$contents = file_get_contents($filePath); |
1113
|
|
- $new_contents = substr_replace($contents, PHP_EOL . $body, |
|
1113
|
+ $new_contents = substr_replace($contents, PHP_EOL.$body, |
1114
|
1114
|
($after) ? strpos($contents, $keyword) + strlen($keyword) : strpos($contents, $keyword) |
1115
|
1115
|
, 0); |
1116
|
1116
|
return file_put_contents($filePath, $new_contents); |