This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
- Forum
- Guides / Resources
- [HOWTO] get the default database name in eloquent/laravel config
Post a reply
17293 views
Tschallacka
Sometimes when you work with multiple databases you need to get the database name of your default connection.
Sometimes you don't want to hard code it becuase you need to re-use it in multiple enviroments.
To get the default database name that is used by models you can use
Config::get('database.connections.'.Config::get('database.default').'.database')
1-1 of 1
You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.
Latest from the blog
Introducing Larajax in October CMS v4.1
October CMS v4.1 introduces Larajax, a standalone AJAX library for Laravel, plus the Gateway API for partner automation, template caching with the new {% cache %} tag, and multisite traffic statistics.
- October CMS
- Home
- Features
- Hosting
- Roadmap & Portal
- Terms & Conditions
- Contact Us
- About
- Blog
- Discover More
- My Account
- Plugins
- Themes
- Partners
- Support
- Premium Support
- Documentation
- Help Center
- Forum
- Guidelines
- Quality Guidelines
- Developer Guide