"name"]); } // Object methods /** * @return Address * @throws \Exception */ public function getAddress(): Address { $address = Address::get($this->address_id); return $address ?: new Address(); } public function getSlug(): string { return Util::slug("$this->name $this->id"); } public function getUrl(): string { return sprintf("/suppliers/%s", $this->getSlug()); } /** * @return Product[] */ public function getProducts(): array { return Product::query([ "supplier_id" => $this->id, "dts_deleted" => null ], ["sort" => "name"]); } }