Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
Can't read new config variables in laravel 5.4

I added a new config variable to the config/app.php file in laravel like this

'foo' => 'pass'

but when I tried reading it using config('app.foo') I keep getting null while other variables return correct values. What do I need to do?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Syntax you're using is correct, try to clear configuration cache by using this command:

php artisan config:clear
over 4 years ago · Santiago Trujillo Relatório

0

Whenever you change config you must clear old cache.

Laravel saves some common settings in cache e.g. config,packages and services in cache folder. If you face this kind of issue again with config or class not found issue in config/app.php etc then you should see your cached config file (/laravel_project/bootstrap/cache/config.php) to check if required thing is available or not.

Sometimes routes or views does not render changes when you are working on a virtualhost then you also need to clear the cache of that part.

To do so, we have to run multiple command like:

 php artisan cache:clear
 php artisan view:clear
 php artisan route:clear
 php artisan config:clear

But writing these commands daily is annoying thing. So I have created a package for it. https://github.com/afrazahmmad/clear-all-cached-data. install it and run:

php artisan clear:data

and it will run all above commands automatically.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda