I want to filter my data, base on a method on my model:
method in my model:
// . . .
public function isBatched(): bool
{
return $this->rows()->count() > 1;
}
and my qraphql:
type Invoice
{
globalId: ID! @globalId @method(name: "getKey")
localId: Int! @method(name: "getKey")
pdfUrl: String @method(name: "getPdfUrl")
number: String
poNumber: String @rename(attribute: "po_number")
deposit: Deposit @hasOne
rows: [InvoiceRow!] @hasMany
bills: [Bill!] @belongsToMany(type: "paginator", relation: "bills")
isBatched: Boolean! @method(name: "isBatched")
isCompleted: Boolean @method(name: "isPaid")
dueDate: DateTime @rename(attribute: "due_date")
total: Money @method(name: "totalAmountMoney")
}
extend type Query {
invoices: Invoice! @paginate @cache
invoicesb(isBatched: Boolean @eq): [Invoice]! @paginate
}
but it does not work, it says isBatched
filed is not exist, any idea?