title: How to solve route not defined
body: <p>Whenever I run my program, I get an error &quot;Route [userproductss.prdtview] not defined. (View: D:\xampp\htdocs\E-commerce\resources\views\layouts\includes\top.blade.php)&quot;. The code is given below</p>
  <p>blade:</p>
  <pre><code>&lt;ul&gt;
      &lt;li class=&quot;active&quot;&gt;&lt;a href=&quot;&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
      @foreach($categories as $category)
          &lt;li&gt;&lt;a href=&quot;#&quot;&gt;{{$category-&gt;cat_name}}&lt;/a&gt;
          &lt;ul class=&quot;dropdown&quot;&gt;
              @foreach($subcat as $sub_cat)
              @if($sub_cat-&gt;cat_id == $category-&gt;id)
              &lt;li&gt;&lt;a href=&quot;{{ route('userproduct.prdtview',$sub_cat-&gt;id) }}&quot;&gt;&lt;?php echo $sub_cat-&gt;sub_cat_name; ?&gt;&lt;/a&gt;&lt;/li&gt;
              @endif
              @endforeach
          &lt;/ul&gt;
      &lt;/li&gt;
      @endforeach                        
  &lt;/ul&gt;
  </code></pre>
  <p>web.php</p>
  <pre><code>Route::resource('userproduct', 'UserProductController');
  </code></pre>
  <p>controller:</p>
  <pre><code>public function prdtview($id)
  {
      $data=DB::select('select category.cat_name,product_images.prdt_image,product.prdt_name,product.actual_price from product INNER JOIN category on product.catid = category.id INNER JOIN product_images on product.id = product_images.prdt_id where product.sub_cat_id = $id ');
      return view(&quot;frontend.product&quot;,[
          'data' =&gt; $data
      ]);
  }
  </code></pre>