dimanche 7 juillet 2019

Does Laravel automatically connect to the DB upon booting?

I was working on a build step that would run an artisan command at a point where there is no env file at the application root. The command only writes some stuff to the local filesystem disk and does not have anything to do with the database.

This initally threw an error namely SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database 'forge'.

As a workaround, I specified the DB information of my local test database in config/database.php but this seems suboptimal and non-scalable.

Does this mean Laravel always connect to the default database? Is there anyway to disable this, so that commands that do not need a database connection can run without?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire