WouterJEloquentBundle icon indicating copy to clipboard operation
WouterJEloquentBundle copied to clipboard

"A facade root has not been set." exception

Open mariano-gomez opened this issue 6 years ago • 1 comments

I have this configuration in the eloquent.yaml:

wouterj_eloquent: driver: '%env(DB_CONNECTION)%' host: '%env(DB_HOST)%' port: '%env(DB_PORT)%' database: '%env(DB_DATABASE)%' username: '%env(DB_USERNAME)%' password: '%env(DB_PASSWORD)%' eloquent: true aliases: db: true

And when i try to use this query $juegos = DB::table('juegos')->paginate(self::JUEGOS_POR_PAGINA, ['*'], 'page', $page);

i get an exception with the message "A facade root has not been set". The same happens if i comment the eloquent and/or the aliases (with its db subkey) parameters. #

mariano-gomez avatar Apr 21 '18 18:04 mariano-gomez

Hello,

wouterj_eloquent:
  ...
    aliases: true
    eloquent: true

The way you were defining just "expose" the DB::.. facade and some others that's needed, not.

Another thing that may cause issues similar to this is to import it manually when you have it defined on the config. Example: Importing manually on your script \DB but have aliases: db: true on your config file.

duayres avatar Jun 06 '18 13:06 duayres