hasOne('App\OrderPackageCommodities','id','order_package_commodity_id'); } public function owner(){ return $this->hasOne('App\Owner','id','owner_id'); } public function getOwnerNameAttribute(){ return $this->owner['name'] ?? ''; } public function getSkuAttribute(){ return ['sku' => $this->commodities['commodity']['sku'] ?? '', 'skuName' => $this->commodities['commodity']['name'] ?? '', 'skuAmount' => $this->commodities['amount'] ?? '']; } public function getPackageWeightAttribute(){ return $this->commodities->package['weight'] ?? ''; } public function getPackageBulkAttribute(){ return $this->commodities->package['bulk'] ?? ''; } public function getOrderCityAttribute(){ return $this->commodities->package->order['city'] ?? ''; } public function getPackageLogisticNumberAttribute(){ return $this->commodities->package['logistic_number'] ?? ''; } public function getPackageLogisticAttribute(){ return $this->commodities->package->order->logistic['name'] ?? ''; } public function getOrderClientNumberAttribute(){ return $this->commodities->package->order['client_code'] ?? ''; } }