title: make $user is undefined Make the variable optional in the blade template. Replace {{ $user }} with {{ $user ?? '' }}
body: <p>I have one-page sidebar.blade.php and I have to import this page in another page as a sidebar
  I have variable here that is coming from the controller when I import sidebar to other page using @extends it shows me error undefined variable with solution</p>
  
  <p>" make $user is undefined Make the variable optional in the blade template. Replace {{ $user }} with {{ $user ?? '' }}"</p>
  
  <p>how I can solve this  </p>
  
  <p>sidebar code here </p>
  
  <pre><code>@if($user-&gt;role  =="handlers" )  
              &lt;li&gt;
                  &lt;a href="{{ url('/kontaktuppgifter') }}"&gt;&lt;i class="fa fa-user fa-fw"&gt;&lt;/i&gt; kontaktuppgifter{{-- &lt;span class="fa arrow"&gt;&lt;/span&gt; --}}&lt;/a&gt;
  
              &lt;/li&gt;
              @endif
              &lt;li&gt;
  </code></pre>