__("Machine"), self::TYPE_SPARE_PART => __("Spare Part"), self::TYPE_CONSUMABLE => __("Consumable"), ]; } // Object methods /** * @return Supplier * @throws Exception */ public function getSupplier(): Supplier { return Supplier::get($this->supplier_id); } public function getSlug(): string { return Util::slug("$this->name $this->id"); } public function getUrl(): string { return sprintf("/products/%s", $this->getSlug()); } public function getDisplayType(): string { return self::getTypeOptions()[$this->type] ?? ""; } public function getDisplayPrice(): string { return number_format($this->price, 2); } }