$this->id, 'reference' => $this->reference, 'reference_contract' => (int) $this->type, 'type' => (int) $this->type, 'status' => (int) $this->status, 'current_step' => $this->current_step, 'company' => new CompanyResource(Company::where('id',$this->companyModule()->first()->company_id)->first()), 'address' => new AddressResource($this->when($this->has('addresses'), $this->addresses->where('owner_id', $this->id)->first())), 'order_steps' => OrderStepResource::collection($this->orderSteps()->get()), ]; } }