3 namespace App\Console\Commands;
5 use App\Models\ChatLib;
6 use App\Models\ChatLog;
7 use Illuminate\Console\Command;
9 class ChatlibDatabase extends Command {
12 * The name and signature of the console command.
16 protected $signature = 'chatlib:database';
19 * The console command description.
23 protected $description = 'Updates the ChatLib database';
26 * Execute the console command.
30 public function handle() {
33 ChatLog::where('type', '=', 'chat')
34 ->where('banned', '=', false)
35 ->whereNotNull('evaluated_at')
36 ->chunk(500, function ($msgs) use ($db) {
37 foreach ($msgs as $msg) {
38 $db->addMessage($msg);
44 for ($i = 0; $i < 50; ++$i) {
45 $this->line($db->generate());