【发布时间】:2021-12-07 13:22:25
【问题描述】:
我想根据我的模型上的方法过滤我的数据:
我的模型中的方法:
// . . .
public function isBatched(): bool
{
return $this->rows()->count() > 1;
}
还有我的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
}
但它不起作用,它说isBatched 归档不存在,知道吗?
【问题讨论】:
标签: laravel graphql laravel-lighthouse