0

In my .env file, I created a variable

TEST_ENV = false

Now I want to do a check for this variable in blade.php, and if the value matches display the code

I do like this

@if(env('TEST_ENV') = false)
    <!-- some code --> 
    <h1>Test</h1>
@endif

But I get the error

Can't use the function return value in write context

Jignesh Joisar
  • 13,720
  • 5
  • 57
  • 57
  • 3
    `php artisan config:clear` also `@if(env('TEST_ENV') == false)` – Wahyu Kristianto Nov 03 '21 at 12:07
  • 1
    `env('TEST_ENV') = false` a single equals is an assignment, a double-equals is a comparison. You can actually simplify it and remove confusion by doing `@if(!env('TEST_ENV'))` – aynber Nov 03 '21 at 12:16

0 Answers0