1. Go to this page and download the library: Download lazerg/laravel-choices library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lazerg / laravel-choices example snippets
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');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.