title: Dark Mode via PHP and Laravel if statement
body: <p>Was wondering if it is possible. My attempt is to have a dark mode checker within the PHP controller and send it back to the body as an if statement checking if the boolean is true or not.</p>
  
  <p>Here's my current work:
  <br><br>
  Sender URL</p>
  
  <pre><code>&lt;a href="/nightmode"&gt; Switch modes&lt;/a&gt;
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>public function switchModes()
      {
          //doesnt work since $isDark's value is not initialized
          $isDark = !$isDark;
          dd($isDark);
          return $isDark;
      }
  </code></pre>
  
  <p>Target result:</p>
  
  <pre><code>&lt;body background="@if($isDark) #505050 @else #ffffff @endif"&gt;
  </code></pre>