getRouteKey(); } public function title() { if ($this->title != '') { return $this->title; } if ($this->name != '') { return $this->name; } return 'None'; } public function toArray() { return [ 'id' => $this->getRouteKey(), 'title' => $this->title(), 'buyer_company_id' => $this->buyer_company_id, 'supplier_company_id' => $this->supplier_company_id, 'user_id' => $this->user_id, 'user_type' => $this->user_type, 'reference' => $this->reference, 'contract_id' => $this->contract_id, 'name' => $this->name, 'description' => $this->description, 'pricing_type' => $this->pricing_type, 'default_margin' => $this->default_margin, 'add_all_products' => $this->add_all_products, 'standard_costprice' => $this->standard_costprice, 'standard_margin' => $this->standard_margin, 'created_at' => !is_null($this->created_at) ? $this->created_at->format('Y-m-d H:i:s') : null, 'updated_at' => !is_null($this->updated_at) ? $this->updated_at->format('Y-m-d H:i:s') : null, 'meta' => [ 'exists' => $this->exists(), 'link' => $this->itemLink(), 'upload_url' => $this->getUploadURL(''), ], ]; } }