Laravel route not defined error

前端 未结 2 505
野的像风
野的像风 2021-01-25 05:24

I keep getting route not defined error and if I use url() I get server can not provide a secure connection error. I hope I can get some help.

route

相关标签:
2条回答
  • 2021-01-25 05:32

    change view address

    <h4><a href="{{ url('product-show/' .$table_name . '/' .$product->item_id)}}">{{ $product->title }}</a></h4>
    

    OR

    use route helper laravel

    0 讨论(0)
  • 2021-01-25 05:56

    To call a route by name, you should use the route function and add the parameters in an array as the second parameter.

    route('product-show', [$table_name, $product->item_id])
    

    The reason you get a route not defined error is that you are generating the url /product-show/{table_name}/{product_id} and the actual url is /show/{table_name}/{product_id}. Also, adding the parameters manually is bad practice when there are many helper functions that do this for you.

    0 讨论(0)
提交回复
热议问题