title: Laravel - syntax error, unexpected ')', expecting '['
body: <p>I am using Laravel 5.8 to create an App. When I wanted to display the view, it generated an error as shown below:</p>
  
  <p><a href="https://i.stack.imgur.com/2ZedC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2ZedC.png" alt="new error screen"></a></p>
  
  <blockquote>
    <p>syntax error, unexpected ')', expecting '[' </p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/wC8eu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wC8eu.png" alt="unexpected"></a></p>
  
  <p>Controller</p>
  
  <pre><code>    public function serviceOverview(Request $request)
  {
      $data['title'] = 'Subscription Overview';
  $serviceoverviews = DB::table("service_package")
     -&gt;join('services', 'services.id', '=', 'service_package.service_id')
     -&gt;join('service_type', 'service_type.id', '=', 'services.service_type')
     -&gt;select('service_package.title as service_id', 'service_package.title as package_name', DB::raw("DATE(service_package.created_at) as created_at"), 'service_package.price', 'service_package.days','services.name as service_name','service_type.name as service_type');
  
  $render=[];
  
      if(isset($request-&gt;package_name))
      {
          $serviceoverviews=$serviceoverviews-&gt;where('serviceoverviews','like','%'.$request-&gt;serviceoverviews.'%');
          $render['package_name']=$request-&gt;package_name;
      }    
      if(isset($request-&gt;service_id))
      {
          $serviceoverviews=$serviceoverviews-&gt;where('service_id',$request-&gt;service_id);
          $render['service_id']=$request-&gt;service_id;
      }
  
      $serviceoverviews= $serviceoverviews-&gt;orderBy('created_at','DESC');
      $serviceoverviews= $serviceoverviews-&gt;paginate(15);
      $serviceoverviews= $serviceoverviews-&gt;appends($render);
      $data['serviceoverviews'] = $serviceoverviews;    
  
      return view('report.serviceOverview',$data);
  }
  </code></pre>
  
  <p>In the Controller, I tried to do some filtering. Also, I did raw query.</p>
  
  <p>View</p>
  
  <pre><code>    &lt;div class="box box-primary"&gt;
          &lt;div class="box-header with-border"&gt;
              @if(Session::has('flash_message'))
          &lt;div class="alert alert-success"&gt;
              {{ Session::get('flash_message') }}
          &lt;/div&gt;
          @endif 
          @if(count($detailsubscriptions))            
      &lt;table class="table table-bordered table-hover table-striped table-condesed" id="commenter_info_table"&gt;
      &lt;caption&gt;&lt;/caption&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;td&gt;#&lt;/td&gt;
              &lt;td&gt;Service&lt;/td&gt;
              &lt;td&gt;Package&lt;/td&gt;
              &lt;td&gt;Service Type&lt;/td&gt;
              &lt;td&gt;Date&lt;/td&gt;
              &lt;td&gt;Price&lt;/td&gt;
              &lt;td&gt;Days&lt;/td&gt;
  
          &lt;/tr&gt;
      &lt;/thead&gt;
  
      &lt;tbody&gt;
          @foreach($serviceoverviews as $key =&gt; serviceoverview)
              &lt;tr&gt;
                  &lt;td&gt;{{ ++$key }}&lt;/td&gt;
                  &lt;td&gt;{{ serviceoverview-&gt;service_name }}&lt;/td&gt;
                  &lt;td&gt;{{ $serviceoverview-&gt;package_name }}&lt;/td&gt;
                  &lt;td&gt;{{ $serviceoverview-&gt;service_type }}&lt;/td&gt;
                  &lt;td&gt;{{ serviceoverview-&gt;created_at }}&lt;/td&gt;
                  &lt;td&gt;{{ $serviceoverview-&gt;price }}&lt;/td&gt;
                  &lt;td&gt;{{ $serviceoverview-&gt;days }}&lt;/td&gt;                
              &lt;/tr&gt;
  
          @endforeach
              &lt;tr&gt;
              &lt;td colspan="8"&gt;
                  {{ $serviceoverview-&gt;links() }}
              &lt;/td&gt;
              &lt;/tr&gt;         
      &lt;/tbody&gt;  
  
      &lt;/table&gt;   
              @else
          &lt;div class="row text-center"&gt;
              &lt;h2&gt;No Service Overview to show&lt;/h2&gt;
          &lt;/div&gt;
          @endif        
      &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  
  
  <p>I tried to check the code, but found nothing. How do I resolve this issue</p>