laravel get database name from connection code example
Example 1: get database name laravel
DB::getDatabaseName();
Example 2: db name laravel
DB::connection()->getDatabaseName() //laravel
DB::getDatabaseName();
DB::connection()->getDatabaseName() //laravel