close

Accessing Laravel .env variables in blade

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Accessing Laravel .env variables in blade in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Accessing Laravel .env variables in blade Error Occurs?

Today I get the following error Accessing Laravel .env variables in blade in php.

How To Solve Accessing Laravel .env variables in blade Error ?

  1. How To Solve Accessing Laravel .env variables in blade Error ?

    To Solve Accessing Laravel .env variables in blade Error It causes problems to use env() anywhere else than in the config/ folder. Use env in there and then config () in the other parts of the app

  2. Accessing Laravel .env variables in blade

    To Solve Accessing Laravel .env variables in blade Error It causes problems to use env() anywhere else than in the config/ folder. Use env in there and then config () in the other parts of the app

Solution 1

I have it implemented in the following way:

@if (env('APP_ENV')!='Production')
Enviroment Test
@endif

My recommendation is to execute the following command: composer self-update

Solution 2

It causes problems to use env() anywhere else than in the config/ folder. Use env in there and then config () in the other parts of the app

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment