| Conditions | 2 |
| Paths | 2 |
| Total Lines | 33 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | protected function installInertiaReactStack() |
||
| 16 | { |
||
| 17 | $fs = new Filesystem; |
||
| 18 | $guard = $this->argument('guard'); |
||
|
|
|||
| 19 | $pluralClass = Str::plural(Str::studly($guard)); |
||
| 20 | $singularSlug = Str::singular(Str::slug($guard)); |
||
| 21 | $singularClass = Str::singular(Str::studly($guard)); |
||
| 22 | |||
| 23 | // Module... |
||
| 24 | $fs->ensureDirectoryExists(app_path("Modules/{$pluralClass}")); |
||
| 25 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/inertia/src', app_path("Modules/{$pluralClass}")); |
||
| 26 | |||
| 27 | // Views... |
||
| 28 | // $fs->ensureDirectoryExists(resource_path("js")); |
||
| 29 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/react/resources/js', resource_path("js")); |
||
| 30 | |||
| 31 | // $fs->ensureDirectoryExists(resource_path("views")); |
||
| 32 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/react/resources/views', resource_path("views")); |
||
| 33 | |||
| 34 | // Tests... |
||
| 35 | $fs->ensureDirectoryExists(base_path("tests/Feature/{$pluralClass}")); |
||
| 36 | if ($this->option('pest')) { |
||
| 37 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/inertia/pest-tests/Feature', base_path("tests/Feature/{$pluralClass}")); |
||
| 38 | } else { |
||
| 39 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/inertia/tests/Feature', base_path("tests/Feature/{$pluralClass}")); |
||
| 40 | } |
||
| 41 | |||
| 42 | // Conclude... |
||
| 43 | $this->info("{$singularClass} guard successfully setup."); |
||
| 44 | |||
| 45 | $serviceProvider = "App\\Modules\\{$pluralClass}\\{$singularClass}ServiceProvider::class"; |
||
| 46 | |||
| 47 | $this->info("\nRegister `{$serviceProvider}` in `config/app.php`"); |
||
| 48 | } |
||
| 50 |