title: laravel function show in controller
body: <p>I'm trying to show lessons from the course when i clicked on.</p>
  
  <p>model lesson</p>
  
  <pre><code>public function course(){
      return $this-&gt;belongsTo(Course::class);
  }
  </code></pre>
  
  <p>model course</p>
  
  <pre><code> public function lesson() {
     return $this-&gt;hasMany(Lesson::class);
  </code></pre>
  
  <p>}</p>
  
  <p>show controller</p>
  
  <pre><code> public function show($id)
  {
      $cours = Course::findOrFailnd($id);
      $lessons = course::findOrFail($id)-&gt;lesson;
      return view('pages.lessons', compact('lessons', 'cours'));
  
  }
  </code></pre>
  
  <p>page lesson</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;strong&gt;Lessons : &lt;/strong&gt;
      @foreach ($lessons as $lesson )
  
      {{$lesson-&gt;long_text}}
  
  
      @endforeach
  &lt;/div&gt;
  </code></pre>
  
  <p>web routes</p>
  
  <pre><code>Route::resource('pages/lessons', 'LessonsController@show')-&gt;name('pages.lessons');
  </code></pre>
  
  <p>and i have this error:</p>
  
  <pre><code>Type error: Too few arguments to function Illuminate\Routing\PendingResourceRegistration::name(), 1 passed in C:\wamp64\www\learn2code\routes\web.php on line 21 and exactly 2 expected
  </code></pre>