belongsTo(Order::class); } /** * BelongsTo product relation * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function product() { return $this->belongsTo(Product::class); } // * METHODS /** * Getter formated_total_ht * * @return string */ public function getFormattedTotalHtAttribute(): string { return sprintf( '%s €', number_format($this->total_ht / 100, 2, ',', ' ') ); } /** * Getter formated_total_ttc * * @return string */ public function getFormattedTotalTtcAttribute(): string { return sprintf( '%s €', number_format($this->total_ttc / 100, 2, ',', ' ') ); } }