title: Update function keep getting this error: The PATCH method is not supported for this route. Supported methods: GET, HEAD
body: <p>I kept getting this error when trying to use the update function in edit view, but not sure how to fix it. </p>
  
  <pre><code>       Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
         The PATCH method is not supported for this route. Supported methods: GET, HEAD.
  </code></pre>
  
  <p>here is the edit blade: </p>
  
  <pre><code>      &lt;form method="POST" action="{{ route("course.update", [auth()-&gt;user()-&gt;username, $course-&gt;title. $course-&gt;id]) }}" enctype="multipart/form-data"&gt;
          @method('PATCH')
          @csrf
  </code></pre>
  
  <p>here is the web.php: </p>
  
  <pre><code>      Route::get('/{user}/edit_{course}', 'CoursesController@edit')-&gt;name('course.edit');
        Route::patch('/{user}/update_{course}', 'CoursesController@update')-&gt;name('course.update');
  </code></pre>
  
  <p>the update url only shows like this, without the variables {course}:</p>
  
  <pre><code>      /{user}/update_
  </code></pre>
  
  <p>edit url works fine, using the same format. but the $course data doesn't seem passing into the edit view: </p>
  
  <pre><code>      {{ route("course.edit", [auth()-&gt;user()-&gt;username, $course-&gt;title. $course-&gt;id]) }}
  </code></pre>
  
  <p>here is the controller: </p>
  
  <pre><code>      public function edit(Course $course) {
          return view('courses.edit', compact('course'));
        }
  
        public function update(UpdateCourseRequest $request, Course $course) {
          $course-&gt;update($request-&gt;all());
          if (count($course-&gt;course_images) &gt; 0) {
             foreach ($course-&gt;course_images as $media) {
                if (!in_array($media-&gt;file_name, $request-&gt;input('course_images', []))) {
                 $media-&gt;delete();
             }
           }
         }
          $media = $course-&gt;course_images-&gt;pluck('file_name')-&gt;toArray();
          foreach ($request-&gt;input('course_images', []) as $file) {
              if (count($media) === 0 || !in_array($file, $media)) {
                 $course-&gt;addMedia(storage_path('tmp/uploads/' . $file))-&gt;toMediaCollection('course_images');
                 }
              }
          return view('courses.index', compact('course'));
          }          
  </code></pre>