Mercurial > packages > auth
comparison src/Console/InstallCommand.php @ 2:ac199a7a8931 default tip
Changes to the views and only defualt option is available
| author | luka |
|---|---|
| date | Tue, 19 Aug 2025 20:32:36 -0400 |
| parents | 90e38de8f2ba |
| children |
comparison
equal
deleted
inserted
replaced
| 1:a2a3059de103 | 2:ac199a7a8931 |
|---|---|
| 1 <?php | 1 <?php |
| 2 | 2 |
| 3 namespace Wizard\Auth\Console; | 3 namespace Wizard\Auth\Console; |
| 4 | 4 |
| 5 use Illuminate\Console\Command; | 5 use Illuminate\Console\Command; |
| 6 use Illuminate\Contracts\Console\PromptsForMissingInput; | |
| 7 use Illuminate\Filesystem\Filesystem; | 6 use Illuminate\Filesystem\Filesystem; |
| 8 use Illuminate\Support\Arr; | 7 use Illuminate\Support\Arr; |
| 9 use Illuminate\Support\Str; | 8 use Illuminate\Support\Str; |
| 10 use RuntimeException; | 9 use RuntimeException; |
| 11 use Symfony\Component\Console\Attribute\AsCommand; | 10 use Symfony\Component\Console\Attribute\AsCommand; |
| 17 | 16 |
| 18 use function Laravel\Prompts\confirm; | 17 use function Laravel\Prompts\confirm; |
| 19 use function Laravel\Prompts\multiselect; | 18 use function Laravel\Prompts\multiselect; |
| 20 use function Laravel\Prompts\select; | 19 use function Laravel\Prompts\select; |
| 21 | 20 |
| 22 #[AsCommand(name: 'breeze:install')] | 21 #[AsCommand(name: 'auth:install')] |
| 23 class InstallCommand extends Command implements PromptsForMissingInput | 22 class InstallCommand extends Command |
| 24 { | 23 { |
| 25 use InstallsBladeStack; | 24 use InstallsBladeStack; |
| 26 | 25 |
| 27 /** | 26 /** |
| 28 * The name and signature of the console command. | 27 * The name and signature of the console command. |
| 29 * | 28 * |
| 30 * @var string | 29 * @var string |
| 31 */ | 30 */ |
| 32 protected $signature = 'breeze:install {stack : The development stack that should be installed (blade)}'; | 31 protected $signature = 'auth:install'; |
| 33 | 32 |
| 34 /** | 33 /** |
| 35 * The console command description. | 34 * The console command description. |
| 36 * | 35 * |
| 37 * @var string | 36 * @var string |
| 38 */ | 37 */ |
| 39 protected $description = 'Install the Breeze controllers and resources'; | 38 protected $description = 'Install the Basic Auth controllers and resources'; |
| 40 | 39 |
| 41 /** | 40 /** |
| 42 * Execute the console command. | 41 * Execute the console command. |
| 43 * | 42 * |
| 44 * @return int|null | 43 * @return int|null |
| 55 */ | 54 */ |
| 56 protected function installTests() | 55 protected function installTests() |
| 57 { | 56 { |
| 58 (new Filesystem)->ensureDirectoryExists(base_path('tests/Feature')); | 57 (new Filesystem)->ensureDirectoryExists(base_path('tests/Feature')); |
| 59 | 58 |
| 60 $stubStack = match ($this->argument('stack')) { | 59 (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/default/tests/Feature', base_path('tests/Feature')); |
| 61 default => 'default', | |
| 62 }; | |
| 63 | |
| 64 (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/'.$stubStack.'/tests/Feature', base_path('tests/Feature')); | |
| 65 | 60 |
| 66 return true; | 61 return true; |
| 67 } | 62 } |
| 68 | 63 |
| 69 /** | 64 /** |
| 338 file_put_contents($file->getPathname(), preg_replace('/\sdark:[^\s"\']+/', '', $file->getContents())); | 333 file_put_contents($file->getPathname(), preg_replace('/\sdark:[^\s"\']+/', '', $file->getContents())); |
| 339 } | 334 } |
| 340 } | 335 } |
| 341 | 336 |
| 342 /** | 337 /** |
| 343 * Prompt for missing input arguments using the returned questions. | |
| 344 * | |
| 345 * @return array | |
| 346 */ | |
| 347 protected function promptForMissingArgumentsUsing() | |
| 348 { | |
| 349 return [ | |
| 350 'stack' => fn () => select( | |
| 351 label: 'Which Breeze stack would you like to install?', | |
| 352 options: [ | |
| 353 'blade' => 'Blade', | |
| 354 ], | |
| 355 scroll: 6, | |
| 356 ), | |
| 357 ]; | |
| 358 } | |
| 359 | |
| 360 /** | |
| 361 * Interact further with the user if they were prompted for missing arguments. | |
| 362 * | |
| 363 * @return void | |
| 364 */ | |
| 365 protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output) | |
| 366 { | |
| 367 $stack = $input->getArgument('stack'); | |
| 368 } | |
| 369 | |
| 370 /** | |
| 371 * Determine whether the project is already using Pest. | 338 * Determine whether the project is already using Pest. |
| 372 * | 339 * |
| 373 * @return bool | 340 * @return bool |
| 374 */ | 341 */ |
| 375 protected function isUsingPest() | 342 protected function isUsingPest() |
