title: Laravel chained/linked select box failed to load resource status 500 internal server error
body: <h3>Complete Edit</h3>
  <p>I've edited my original question as I've refined my code which has put me in a much better position to define a better error</p>
  <p>Hi I'm creating a chained select box that will once a client is selected find the clients projects.</p>
  <p>The ajax is doing its job it knows which client has been selected and my console tells me the following:</p>
  <p><code>Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://itempus.dev/task/clientsprojects?option=5</code></p>
  <p>The above option value refers to the client id which I want to pass into the projects db and find the clients projects. I'm not sure what I am doing wrong and would appreciate some help in a somewhat complex task for a newbie.</p>
  <h3>TaskController</h3>
  <pre><code>public function create()
      {
          $tasks = Auth::user()-&gt;tasks;   
          $client_options = DB::table('clients')-&gt;orderBy('client_name', 'asc')-&gt;lists('client_name','id');
          $team_options = DB::table('teams')-&gt;orderBy('team_member_name', 'asc')-&gt;lists('team_member_name','id', 'team_member_category');
          return View::make('tasks.create', array('project_options' =&gt; $project_options, 'team_options' =&gt; $team_options, 'client_options' =&gt; $client_options));
  }       
          
  public function clientsprojects() {
          
          $input = Input::get('option');
          $client_id = Project::find($input);
          $projects = DB::table('projects')-&gt;where('client_id', $client_id-&gt;id)
                                             -&gt;orderBy('project_name')
                                             -&gt;lists('id','project_name');
          $models = $project-&gt;projects();
          return Response::eloquent($models-&gt;get(array('id','project_name')));    
          }
  </code></pre>
  <h3>views/tasks/create.blade.php</h3>
  <pre><code>{{ Form::open(array('action' =&gt; 'TaskController@store', 'id' =&gt; 'createuser')) }}
      &lt;div class=&quot;form-group&quot;&gt;
          @if(count($client_options)&gt;0)
   
             {{ Form::label('select_client', 'Assign to Client', array('class' =&gt; 'awesome client_option'));  }}
          {{ Form::select('client', $client_options , Input::old('client'), array('class' =&gt; 'tempus_select client_option', 'id' =&gt; 'select_client')) }}
  
          @endif 
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group deletegates&quot;&gt;
   
              {{ Form::label('select_client', 'Assign to Project', array('class' =&gt; 'awesome'));  }}
          {{ Form::select('project', array_merge(array('default' =&gt; 'Please Select')), 'default', array('class' =&gt; 'tempus_select', 'id' =&gt; 'project_select')) }}
  
       &lt;/div&gt;
      {{ Form::submit('Create the task!', array('class' =&gt; 'btn btn-primary')) }}
  
  {{ Form::close() }}
  &lt;script&gt;
      $(document).ready(function($){
          $('#select_client').change(function(){
          $.get(&quot;{{ url('task/clientsprojects')}}&quot;, 
          { option: $(this).val() }, 
          function(data) {
              var model = $('#project_select');
              model.empty();
  
              $.each(data, function(index, element) {
                  model.append(&quot;&lt;option value='&quot;+ element.id +&quot;'&gt;&quot; + element.name + &quot;&lt;/option&gt;&quot;);
              });
          });
          });
      });
  &lt;/script&gt;
  </code></pre>
  <p>Route.php</p>
  <p>I've also defined my route as so:</p>
  <pre><code>Route::get('task/clientsprojects', function(){
      $input = Input::get('option');
      $client_id = Project::find($input);
      $projects = DB::table('projects')-&gt;where('client_id', $client_id-&gt;id)
                                 -&gt;orderBy('project_name')
                                 -&gt;lists('id','project_name');
      $models = $project-&gt;projects();
      return Response::eloquent($models-&gt;get(array('id','project_name')));
  });
  </code></pre>