(float) $value / 100, set: fn (float $value) => (int) ($value * 100), ); } protected function installationPrice(): Attribute { return Attribute::make( get: fn(int $value) => (float) $value / 100, set: fn (float $value) => (int) ($value * 100), ); } protected function servicePrice(): Attribute { return Attribute::make( get: fn(int $value) => (float) $value / 100, set: fn (float $value) => (int) ($value * 100), ); } protected function totalPrice(): Attribute { return Attribute::make( get: fn(int $value) => (float) $value / 100, set: fn (float $value) => (int) ($value * 100), ); } public function productPriceTxt(): Attribute { return Attribute::make( get: fn($value) => Price::format($this->product_price), ); } public function installationPriceTxt(): Attribute { return Attribute::make( get: fn($value) => Price::format($this->installation_price), ); } protected function totalPriceTxt(): Attribute { return Attribute::make( get: fn($value) => Price::format($this->total_price), ); } public function commonName(): Attribute { return Attribute::make( get: fn($value) => (string) $this->name_tz . ' (арт.' . $this->article . ', №' . $this->nomenclature_number . ', ' . $this->year . 'г, ' . $this->product_price_txt . ')', ); } /** * @return BelongsToMany */ public function orders(): BelongsToMany { return $this->belongsToMany(Order::class, 'order_product'); } }