hasOne('\App\Models\ImsCjdcUser','id','user_id'); } public function store() { return $this->hasOne('\App\Models\LanzuStore','id','store_id'); } public static function getOrdersData($oid) { $orders = ImsCjdcOrder::with('user')->with('store') ->where('order_main_id', $oid)->get()->toArray(); if (count($orders)) { foreach ($orders as &$or) { if (substr($or['store']['logo'], 0, 4) != 'http') { $or['store']['logo'] = env('IMG_HOST') . '/' . $or['store']['logo']; } $or['goods'] = LanzuOrderGoods::where('order_id', $or['id'])->get()->toArray(); } } return json_encode($orders); } }