yinchuanjiang

1479 经验值

现在的业务逻辑是 查询成交订单的客户信息时 会关联这个客户的订单(orders 一对多) ,客户信息(customer一对一的反向),分组信息和订单信息(一对多) ,其中订单模型2个一对多的反向 用户(user)和购买的产品信息(product),
我想在关联查询订单的时候能不能直接带出来订单的关联数据 不用下面的foreach 该如何操作呢

    {
        $limit = request('limit')?:15;
        $data = $customerService->Upper($this->user->team_group_id)->paginate($limit);
        $data->load('customer','teamGroup','orders');
        if($data->isEmpty())
        {
            return $this->msg([],"03","并没有搜索到");
        }
        //return new CustomerServiceCollection($data);
        $data = $data->toArray();
        foreach ($data['data'] as &$d){
            $d['total_price'] = Order::where('customer_id',$d['customer_id'])->sum('price');
            $d['first_order'] = Order::where('customer_id',$d['customer_id'])->orderBy('id','asc')->value('collect_date');
            foreach ($d['orders'] as &$dd){
                $dd['user'] = Order::find($dd['id'])->user;
                $dd['product'] = Order::find($dd['id'])->product;
            }
        }
        $ename = request('ename');
        
        //条件筛选
        return $this->msg($data);
    }

修改掉默认的.dev 就好了 好奇怪

PING hello.dev (127.0.53.53): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4 我这个是怎么回事呀

请问:我是用wangeditor编辑器上传图片,在控制器做验证为什么拿不到validate返回的josn错误,老是302到提交页面 ?有知道的吗
、、、
public function imageUpload(Request $request)

{
    // 自动生成唯一文件名...
    //方法1
    //$path = Storage::putFile('photo', new File(request('wangEditorH5File')));
    //方法2
    $this->validate($request,[
       'wangEditorH5File' => 'file|max:10'
    ]);
    $path = $request->file('wangEditorH5File')->store('photo');
    return asset('storage/'.$path);
    //dd(request('wangEditorH5File'));
}

、、、
7dd03285-99a1-4da2-8181-056a4657e549