lazerg / laravel-choices
此包已被弃用,不再维护。未建议替代包。
此包最新版本(v1.0.0)未提供许可证信息。
v1.0.0
2023-06-06 13:45 UTC
Requires
- php: ^8.0
- illuminate/console: ^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/database: ^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/support: ^6.0|^7.0|^8.0|^9.0|^10.0
README
命令行选择
此包允许开发者创建具有自动补全的多个答案的命令行界面来提问。
安装
composer require lazerg/laravel-choices
与seeder一起使用
use Lazerg\LaravelChoices\ChoicesForSeeders; class DatabaseSeeder extends Seeder { use ChoicesForSeeders; public function run() { $this // Possible answers for this choice is: NO, No, no // as second argument does not exist, will skip this step // if user select this choice ->askWithChoices('No') // Possible answers for this choice is: YES, Yes, yes // If user select this choice, callback on second argument will be run ->addChoice('Yes', fn() => $this->call(FakeDataSeeder::class)) // Second argument here is default answer, // if user press enter without answering ->ask('Run FakeDataSeeder?', 'No'); } }