title: Call model in app.blade.php Laravel 5.2
body: <pre><code>@foreach (App\Category::orderBy('name')-&gt;get() as $category)
                  &lt;li&gt;
                  &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"&gt;
                          {{$category-&gt;name}} &lt;span class="caret"&gt;&lt;/span&gt;
                  &lt;/a&gt;
  
                  &lt;ul class="dropdown-menu" role="menu"&gt;
                      &lt;li&gt;&lt;a href="{{ url('/')}}/{{ $category-&gt;name }}"&gt;All {{ $category-&gt;name }}&lt;/a&gt;&lt;/li&gt;
                      @foreach (App\Subcaterogy::where('Category_name', $category-&gt;name)-&gt;orderBy('name')-&gt;get() as $subcategory)
                      &lt;li&gt;&lt;a href="{{ url('/')}}/{{ $subcategory-&gt;category}}/{{ $subcaterogy-&gt;name }}"&gt;{{ $subcategory-&gt;name }}&lt;/a&gt;&lt;/li&gt;
                      @endforeach
                  &lt;/ul&gt;
              &lt;/li&gt;
          @endforeach
  </code></pre>
  
  <p>I have this code in my app.blade.php (my standard layout). I get this error: FatalErrorException in AliasLoader.php line 63:
  Maximum function nesting level of '100' reached, aborting!</p>
  
  <p>But I am only getting this error on the login and register page (standard Laravel authentication), the code works perfectly on all the other pages. On the other hand the login page works perfectly when i delete this part of the code from app.blade.php. What am I doing wrong?</p>