0

The error message is: A facade root has not been set.

enter image description here

enter image description here

Any advice is really helpful.

neifnei
  • 95
  • 1
  • 8

1 Answers1

-2

You should try this:

Leave a default or null value in your config/database.php file. Create a new service provider (either with the artisan command or manually)

php artisan make:provider DatabaseConfigProvider

Then add the new provider to the $providers array in your config/app.php file.

Finally add the following code to the boot() method.

public function boot()
{
    $result= \DB::select('select version() as version')[0];
    $this->app['config']->put('database.connections.mysql.version', $result->version);
}

The key in the put() argument can be whatever you want.

  • Finnally I changed the config file approach to database approach . Anyway,thanks for you help. – neifnei Jan 18 '19 at 07:03