Laravel:withCount关系

时间:2019-12-02 08:41:03

标签: laravel relation laravel-6

我需要根据已完成的最大购买次数显示事件。而我的代码如下

Caused by: java.net.MalformedURLException: unknown protocol: null
    at org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit.setupConnection(AsyncHTTPConduit.java:155)
    at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:505)
    at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:47)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:441)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:356)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:140)

但是我需要基于购买交易的计数。像

Event::withCount(['purchases'])
       ->limit(6)->orderBy('purchases_count', 'DESC')->get();

怎么可能?

0 个答案:

没有答案