Laravel persistent connection to mysql

database.php
'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
            'options' => [
                \PDO::ATTR_PERSISTENT => true
            ]
        ],
6 июня 2019, 16:51

Set up global variable in Laravel

App::instance('var', $var);
$var = \App::make('var');
20 января 2017, 23:03