3 namespace App\Console\Commands;
5 use App\Models\ChatLib;
6 use Illuminate\Console\Command;
8 class ChatlibGenerate extends Command {
11 * The name and signature of the console command.
15 protected $signature = 'chatlib:generate {which=de} {amount=50}';
18 * The console command description.
22 protected $description = 'Generates samples from a ChatLib database';
25 * Execute the console command.
29 public function handle() {
31 $start = microtime(true);
32 $this->line('loading database');
34 $db->loadFrom($this->argument('which'));
36 number_format(microtime(true) - $start, 2).'s '.
37 number_format(memory_get_usage() / 1024 / 1024, 3).'MB now '.
38 number_format(memory_get_peak_usage() / 1024 / 1024, 3).'MB peak');
40 $amount = intval($this->argument('amount'));
41 for ($i = 0; $i < $amount; ++$i) {
42 $this->line($db->generate());