每当我运行程序时,都会收到错误“路线 [userproductss.prdtview] 未定义。(视图:D:\xampp\htdocs\E-commerce\resources\views\layouts\includes\top.blade.php)”。代码如下
刀刃:
<ul>
<li class="active"><a href="">Home</a></li>
@foreach($categories as $category)
<li><a href="#">{{$category->cat_name}}</a>
<ul class="dropdown">
@foreach($subcat as $sub_cat)
@if($sub_cat->cat_id == $category->id)
<li><a href="{{ route('userproduct.prdtview',$sub_cat->id) }}"><?php echo $sub_cat->sub_cat_name; ?></a></li>
@endif
@endforeach
</ul>
</li>
@endforeach
</ul>
网页.php
Route::resource('userproduct', 'UserProductController');
控制器:
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("frontend.product",[
'data' => $data
]);
}
哈士奇WWW
ibeautiful