-2

I dynamically set my database name, but because of my config being cached, I cant set it anymore, any way to solve this?

  • The problem with this is, I can change my data in the config, but because laravel caches it automatically, it just picks up the data from the cache instead of my newly set data in the config – Wouter Comello May 14 '20 at 15:07
  • @WouterComello Yes and the answer from the link is exactly what you need. – Shizzen83 May 14 '20 at 15:09
  • 2
    I fixed it with that @Shizzen83 added DB::purge('mysql'); before changing, it worked, thank you!!!! – Wouter Comello May 14 '20 at 15:15
  • If you want to use multiple database check this once, https://stackoverflow.com/questions/31847054/how-to-use-multiple-databases-in-laravel – Kamlesh Jha May 16 '20 at 05:16

1 Answers1

0

This chould be due to config cache not being cleared, which can be done by artisan config:clear


EDIT: Updated my answer to follow the community standards.

yxzz2
  • 31
  • 7
  • 3
    Answers that start with "try" should include what you expect to happen when they are tried, and also information about how to undo any side effects if they don't produce the desired result. – Jason Aller May 14 '20 at 15:42
  • While this code may resolve the OP's issue, it is best to include an explanation as to how your code addresses the OP's issue. In this way, future visitors can learn from your post, and apply it to their own code. SO is not a coding service, but a resource for knowledge. Also, high quality, complete answers are more likely to be upvoted. These features, along with the requirement that all posts are self-contained, are some of the strengths of SO as a platform, that differentiates it from forums. You can edit to add additional info &/or to supplement your explanations with source documentation. – SherylHohman May 15 '20 at 00:41