'boolean', ]; public function company(): BelongsTo { return $this->belongsTo(FilamentCompanies::companyModel(), 'company_id'); } public function createdBy(): BelongsTo { return $this->belongsTo(FilamentCompanies::userModel(), 'created_by'); } public function category(): BelongsTo { return $this->belongsTo(Category::class, 'category_id')->withDefault([ 'name' => 'General', ]); } public function tax(): BelongsTo { return $this->belongsTo(Tax::class, 'tax_id'); } public function discount(): BelongsTo { return $this->belongsTo(Discount::class, 'discount_id'); } public function document_items(): HasMany { return $this->hasMany(DocumentItem::class); } public function bill_items(): HasMany { return $this->document_items()->where('type', 'bill'); } public function invoice_items(): HasMany { return $this->document_items()->where('type', 'invoice'); } }