title: How to filter taskId regarding to each projectId in Laravel?
body: <p>in My laravel 5.2 application I need print each tasks name in show.blade.php file in tasks folder
  tasks/show.blade.php</p>
  
  <pre><code>&lt;h2&gt;{{$task-&gt;project-&gt;project_name}}&lt;/h2&gt;
  &lt;hr&gt;
  {{$task-&gt;task_name}}
  &lt;hr&gt;
  {!!$task-&gt;body!!}
  &lt;hr&gt;
  @include('comments.form')
  
  @include('files.form')
  </code></pre>
  
  <p>this is My taskController show method</p>
  
  <pre><code>public function show($id)
   {
      $project = Project::find($id);
      $task = Task::find($id);
      $files = $this-&gt;getFiles($id);
  return view('tasks.show')-&gt;withProject($project)-&gt;withFiles($files)-&gt;withTask($task);
   }
  </code></pre>
  
  <p>My task table like this way</p>
  
  <pre><code>id  task_name  project_id
   1     jui          1
   2     kiu          2
   3     hyu          1  
  </code></pre>
  
  <p>but my problem is when I print </p>
  
  <pre><code>{{$task-&gt;task_name}}
  </code></pre>
  
  <p>here it is always displaying task id no 1 task name only. how can fix this problem?</p>
  
  <p><strong>Edited</strong>
  I need print each task details when I click on each task name on index.blade.php in task folder</p>
  
  <p>index.blade.php</p>
  
  <pre><code>@foreach ($project-&gt;tasks as $task)
    &lt;h4&gt;&lt;i class="fa fa-check-square-o"&gt;&lt;/i&gt; &lt;span&gt;&lt;a href="/projects/{{$project-&gt;id}}/tasks/{{ $task-&gt;id }}"&gt;{{ $task-&gt;task_name }}&lt;/a&gt;
  @endforeach
  </code></pre>