#Spatie Query Builder Global Search Trough Relationship

2 messages · Page 1 of 1 (latest)

tepid spoke
#

I have two models, "Borrowing" and "Copy", where a copy can have multiple borrowings.

Now I want to have a table that basically lists all the borrowings, but that you can search specifically for a specific field ("barcode_nmbr") of the related copy. I want to implement this with the Spatie Query Builder, but I'm not really getting anywhere. I already have a "copy()" method in the borrowing model that simply returns the BelongsTo Relationship.

#

This is how it looks so far but it doesn't really work.