title: Laravel Eloquent - This page isn’t working 127.0.0.1 is currently unable to handle this request. HTTP ERROR 500
body: <p>I was able to create groups by geography and country, it worked well (see image attachment)<a href="https://i.stack.imgur.com/7pT8V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7pT8V.png" alt="enter image description here"></a></p>
  
  <p>Controller</p>
  
  <pre><code>$table_companies = Clients::selectRaw('geography geography, country country')-&gt;groupBy('geography', 'country')-&gt;get()-&gt;toArray();
  return view('about.our-clients', compact('our-clients','table_companies'));
  </code></pre>
  
  <p>View</p>
  
  <pre><code>@foreach ($table_companies as $geography)
    &lt;div class="row"&gt;
         &lt;div class="col-lg-12 text-center" 
              style="color:#000000"&gt;
            &lt;h2 class="bigFont text-center"&gt;
               {{ $geography['geography'] }}
            &lt;/h2&gt;
         &lt;/div&gt;
  
       @foreach ($table_companies as $country)
         &lt;div class="col-lg-12" style="padding:25px 0"&gt;
            &lt;h2 class="text-center" 
                style="background-color:#000000;
                       color:#ffffff;
                       font-size:1.4em;padding:5px 0;"&gt;  
                {{ $country['country'] }}
            &lt;/h2&gt;
         &lt;/div&gt;
         &lt;div class="col-lg-12"&gt;
            &lt;div class="row"&gt;
                &lt;!--Company names will be loaded here--&gt;
            &lt;/div&gt;
         &lt;/div&gt;
       @endforeach
    &lt;/div&gt;
    &lt;br&gt;&lt;br&gt;
  @endforeach
  </code></pre>
  
  <p>The problem begins when I try to get the company names</p>
  
  <p>Controller</p>
  
  <pre><code>$table_companies = Clients::selectRaw('geography geography, country country, name_company company')-&gt;groupBy('geography', 'country', 'company')-&gt;get()-&gt;toArray();
  </code></pre>
  
  <p>View</p>
  
  <pre><code>@foreach ($table_companies as $geography)
      &lt;div class="row"&gt;
          &lt;div class="col-lg-12" class="text-center" style="color:#000000"&gt;
            &lt;h2 class="bigFont text-center"&gt;
               {{ $geography['geography'] }}
           &lt;/h2&gt;
          &lt;/div&gt;
      @foreach ($table_companies as $country)
        &lt;div class="col-lg-12" style="padding:25px 0"&gt;
          &lt;h2 class="text-center" 
              style="background-color:#000000;
                     color:#ffffff;
                     font-size: 1.4em;
                     padding:5px 0;"&gt;
           {{ $country['country'] }}
          &lt;/h2&gt;
        &lt;/div&gt;
        &lt;div class="col-lg-12"&gt;
          &lt;div class="row"&gt;
              @foreach ($table_companies as $companies)
                &lt;div class="col-sm-4"&gt;{{ $companies['company'] }}&lt;/div&gt;
              @endforeach 
              &lt;/div&gt;
            &lt;/div&gt;
          @endforeach
      &lt;/div&gt;
  @endforeach
  </code></pre>
  
  <p>This page isn’t working
  127.0.0.1 is currently unable to handle this request.
  HTTP ERROR 500</p>