composer require "illuminate/database"
composer require "illuminate/events"

Config/Events.php

use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;

function boostEloquent() {
  $capsule = new Capsule;

  $capsule->addConnection([
    'driver' => 'mysql',
    'host' => 'localhost',
    'database' => 'database',
    'username' => 'root',
    'password' => 'password',
    'charset' => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix' => '',
  ]);

  // Set the event dispatcher used by Eloquent models... (optional)
  $capsule->setEventDispatcher(new Dispatcher(new Container));

  // Make this Capsule instance available globally via static methods... (optional)
  $capsule->setAsGlobal();

  // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
  $capsule->bootEloquent();
}

Events::on('pre_system', function () {
    boostEloquent();

    if (ENVIRONMENT !== 'testing')
    ...
}  

https://www.modb.pro/db/49966