title: How to view the subjects of a particular course
body: <p>I have a list of courses and in each course there is a buttonthat allows me to view all subjects of that particular course.</p>
  
  <p>First, I used this command so laravel already know what the parent element is:</p>
  
  <pre><code>php artisan make:controller CourseSubjectController --model=Subject --parent=Course
  </code></pre>
  
  <p>In the course index.php file I have the button that should allow me to view all the subjects for that particular:</p>
  
  <pre><code>&lt;td&gt;&lt;a class="btn btn-success" href="{{route('departments.course.subjects.index', [$course-&gt;department-&gt;id, $course-&gt;id])}}"&gt;Subjects&lt;/a&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Apparently the url is correct:</p>
  
  <p>The controller looks like this:</p>
  
  <pre><code>public function index(Course $course)
  {
      return $course-&gt;subjects;
  }
  </code></pre>
  
  <p>When I visit the link I encounter this error:</p>
  
  <pre><code>"Type error: Argument 1 passed to App\Http\Controllers\CourseSubjectController::index() must be an instance of App\Course, string given"
  </code></pre>
  
  <p>How can I view the subjects of the course?</p>
  
  <p>Thanks in advance</p>