'integer', 'total' => 'integer', 'discount' => 'float', 'quantity' => 'float', 'discount_val' => 'integer', 'tax' => 'integer', ]; } /** * Offer the line belongs to. */ public function estimate(): BelongsTo { return $this->belongsTo(Estimate::class, 'estimate_id', 'id'); } /** * Catalog entry the line was built from, when there was one. */ public function item(): BelongsTo { return $this->belongsTo(Item::class, 'item_id', 'id'); } /** * Taxes charged on this line, used when the document is in per-item tax * mode. */ public function taxes(): HasMany { return $this->hasMany(Tax::class, 'estimate_item_id', 'id'); } /** * Narrow to one company. The column is left unqualified, as the callers * pass a plain estimate-item query. */ public function scopeWhereCompany(Builder $query, int $company_id): void { $query->where('company_id', '=', $company_id); } }