title: Get Internal Server Error 500 using this code on laravel 5.1
body: <p>I always get internal server error, i was searching for solution but i can't get the best solution to solve my problem.
  How do I fix this issue?
  Internal Server Error 500.
  Her is my code</p>
  
  <p>Router:</p>
  
  <pre><code>Route::get('getdata', function()
  {
  $term = Str::lower(Input::get('term'));
  $data = array(
      'R' =&gt; 'Red',
      'O' =&gt; 'Orange',
      'Y' =&gt; 'Yellow',
      'G' =&gt; 'Green',
      'B' =&gt; 'Blue',
      'I' =&gt; 'Indigo',
      'V' =&gt; 'Violet',
  );
  $return_array = array();
  
  foreach ($data as $k =&gt; $v) {
      if (strpos(Str::lower($v), $term) !== FALSE) {
          $return_array[] = array('value' =&gt; $v, 'id' =&gt;$k);
      }
  }
  return Response::json($return_array);
  });
  </code></pre>
  
  <p>my blade:</p>
  
  <pre><code>    &lt;?= Form::open() ?&gt;
      &lt;?= Form::label('auto', 'Find a color: ') ?&gt;
      &lt;?= Form::text('auto', '', array('id' =&gt; 'auto'))?&gt;
      &lt;br&gt;
      &lt;?= Form::label('response', 'Our color key: ') ?&gt;
      &lt;?= Form::text('response', '', array('id' =&gt;'response', 'disabled' =&gt; 'disabled')) ?&gt;
      &lt;?= Form::close() ?&gt;
  
      &lt;script type="text/javascript"&gt;
          $(function() {
              $("#auto").autocomplete({
                  source: "getdata",
                  minLength: 1,
                  select: function( event, ui ) {
                      $('#response').val(ui.item.id);
                  }
              });
          });
      &lt;/script&gt;
  </code></pre>