Error Lumen 5.7 | A Facade Root Has Not Been Set

A. The Problem

This error found when i want to get data from my local mysql database. I was register mysql configuration in folder config like this,

Image for post

Image for post

Picture 1. Registered mysql configuration in database.php file to simplify

Then i go controller and call data in my database. i got error message like this,

Image for post

Image for post

Picture 2. Using postman to retrieve data from database

B. How I Solve This

I’m search on Google than i got simple way to solve this problem. Just open file bootsrap/app.php, Then uncomment script this.

// $app->withFacades();
// $app->withEloquent();

Make sure you uncomment that script, like this

Image for post

Image for post

Picture 3. Uncomment withFacades()

By the way, i get this information from this link. You can find another way to solve this problem.