php-task1/bootstrap/db.php
2024-05-15 14:00:13 +05:00

19 lines
446 B
PHP

<?php
require "vendor/autoload.php";
use Dotenv\Dotenv;
use Illuminate\Database\Capsule\Manager as Capsule;
$dotenv = Dotenv::createImmutable(ROOT_PATH);
$dotenv->load();
$capsule = new Capsule;
$capsule->addConnection([
"driver" => "mysql",
"host" => $_ENV['DB_HOST'],
"database" => $_ENV['DB_NAME'],
"username" => $_ENV['DB_USER'],
"password" => $_ENV['DB_PASSWORD']
]);
$capsule->setAsGlobal();
$capsule->bootEloquent();