laravel get the the database name 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