php-task1/bootstrap/db.php

19 lines
446 B
PHP
Raw Normal View History

2024-05-15 12:00:13 +03:00
<?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();