Laravel Routes onclick window.location不起作用

时间:2018-04-03 10:46:15

标签: laravel

为什么这不起作用?

select id, post_category_name , geodist(48.712002, 2.677411, latitude, longitude) dist 
  from serv1 
  where match('searchText* @post_category_name All|Shop') and dist < 20;

错误消息如下:

  

方法Illuminate \ View \ View :: __ toString()不得抛出异常,捕获ErrorException:解析错误:语法错误,意外&#39;&#34;&#39;,期待标识符(T_STRING)

感谢任何帮助!

4 个答案:

答案 0 :(得分:0)

你有一个错字。改变这一行

onclick='window.location = "{{URL::route(\"productv2.category\", $website_category->category->group_url.'/'.$website_category->category->complete_url) }}"'>

onclick='window.location = "{{URL::route("productv2.category", $website_category->category->group_url.'/'.$website_category->category->complete_url) }}"'>

答案 1 :(得分:0)

onclick='window.location = "{{route('productv2.category', $website_category->category->group_url.'/'.$website_category->category->complete_url) }}"'>

希望这会起作用

答案 2 :(得分:0)

修改代码如下:

<div class="bewinkel-img"
         @if(!empty($content->category_id) && isset($website_category->category->group_url))
            onclick='window.location = "{{ route("productv2.category", $website_category->category->group_url . '/' . $website_category->category->complete_url) }}"'>
        @elseif(!empty($content->category_group_id) && isset($website_category_group->url))
            onclick='window.location = "{{ route("productv2.category", $website_category_group->url) }}"
        @endif
        <div
            style="
                @if($content->height != "")
                    width:100%;
                    height:{{$content->height}}px;
                @else
                    height:300px;
                @endif
                    background-image: url('{!! cdn_asset($content->img) !!}')
                "
        ></div>
    </div>

答案 3 :(得分:0)

从网址重新启动报价。

所以,改变

<div class="bewinkel-img"
                 @if(!empty($content->category_id) && isset($website_category->category->group_url))
                    onclick='window.location = "{{URL::route(\"productv2.category\", $website_category->category->group_url.'/'.$website_category->category->complete_url) }}"'>

<div class="bewinkel-img"
                 @if(!empty($content->category_id) && isset($website_category->category->group_url))
                    onclick='window.location = "{{URL::route("productv2.category", $website_category->category->group_url.'/'.$website_category->category->complete_url) }}"'>