title: laravel query, syntax error, unexpected '$out' (T_VARIABLE)
body: <p>I think this is more likely an PHP error, and I found a few posts with the same error, however I can't solve the problem from the answers to those.</p>
  
  <p>My code</p>
  
  <pre><code>class consultController extends Controller
  {
      public function index(){
  
  
          return view('pages.consult');
      }
  
      public function find(){
          $input=Request::all();
          $location=$input['location'];
          $spec=$input['specialization']
  
          $out = DB::table('doctors')-&gt;where('location','=', $location)
                                         -&gt;where('specialization_group','=', $specialization)
                                         -&gt;get(); //line 23, error here
          return $out;
      }
  }
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>FatalErrorException in consultController.php line 23:
  syntax error, unexpected '$out' (T_VARIABLE)
  </code></pre>
  
  <p>After resolving the error with semicolon, I'm now getting this error,</p>
  
  <pre><code>ErrorException in Factory.php line 153:
  array_merge(): Argument #2 is not an array 
  </code></pre>
  
  <p>While trying to pass the $out to a view,</p>
  
  <pre><code>class consultController extends Controller
  {
      public function index(){
  
  
          return view('pages.consult');
      }
  
      public function find(){
          $input=Request::all();
          $location=$input['location'];
          $spec=$input['specialization'];
  
          $out = DB::table('doctors')-&gt;where('location','=', $location)
                                         -&gt;where('specialization_group','=', $spec)
                                         -&gt;get();
          return view('pages.doclist')-&gt;with('out',$out);
          //return count($out);
      }
  }
  </code></pre>