packingList->owner instanceof PackingList ? $this->packingList->owner : $this->packingList; return [ 'id' => $this->id, 'type' => $this->type, 'description' => $this->description, 'width' => floatval($this->width), 'height' => floatval($this->height), 'length' => floatval($this->length), 'weight' => $this->weight, 'quantity' => $this->quantity, 'cbm' => (($this->width / 100) * ($this->height / 100) * ($this->length / 100)) * $this->quantity, 'reference' => $this->packingList->reference, 'status' => $this->status, $this->mergeWhen($originalPackingList->owner instanceof Order, [ 'order' => New OrderResource($originalPackingList->owner) ]), 'container' => new ContainerResource($originalPackingList->containers()->first()), 'transport' => new TransportResource($originalPackingList->transports()->first()) ]; } }