belongsTo('App\Models\Document\Document'); } public function scopeType(Builder $query, string $type) { return $query->where($this->table . '.type', '=', $type); } public function scopeInvoice(Builder $query) { return $query->where($this->table . '.type', '=', Document::INVOICE_TYPE); } public function scopeBill(Builder $query) { return $query->where($this->table . '.type', '=', Document::BILL_TYPE); } }