Database [] not configured Laravel 5
In my case I used 2 db connections and the second added was not cached, the command call:
php artisan config:cache
did the trick.
To see what's going on it was sufficient to output the $connections
variable in DatabaseManager->configure
method.
You're using single connection, so you don't need to specify it:
$langs = DB::table('lang')->get();
You should use connection()
method only when you're working with multiple DB connections.
For me the connection worked in development but not in the production environment, so after a lot of searching, I had to rebuild the configuration cache and It has worked. I ran the following command in the laravel root directory:
php artisan config:cache