Filter/scope table data based on a PHP function, not using QueryBuilder based on values in database

Is it possible to filter/scope data in a table, based on some computed values that are not stored in the database? Hypothetical example: A list of users, but only show users that passes a filter function. I can only find filter/scope examples what uses the Query Builder, not anything based on some PHP code running after the query builder but before adding it to the table.
9 Replies
toeknee
toeknee5mo ago
Not at present, will be possible in V4 I believe
Martin Lakrids
Martin Lakrids5mo ago
toeknee, thanks for answering. Is there no way currently to implement some kind of filter between the Database and the table?
Tally
Tally5mo ago
Maybe you can use Sushi https://usesushi.dev/
Sushi 🍣
Eloquent’s missing “array” driver.
Sometimes you just want to use Eloquent without a database.
Martin Lakrids
Martin Lakrids5mo ago
Tally that doesn't seem to be a valid use case, since the data is really in a database, but they just need to be filtered "in between" getting selected from the database and being provided to the table
Tally
Tally5mo ago
You even could use sushi for that
toeknee
toeknee5mo ago
Tally the sushi just re-creates eloquent for static data, opposed to static data filtering etc. I don't see anyway, Dennis and Dan may have another method. I know Dan's jsut close the static data into tables so will have a fresh head if he has any possibiltiies
Dennis Koch
Dennis Koch5mo ago
You could overwrite the getRecords() method. I think that's the last method that gets called before data is passed to the view
toeknee
toeknee5mo ago
Wouldn't that screw the pagination?
Dennis Koch
Dennis Koch5mo ago
Well you need to return the data in the same format as before 😅
Want results from more Discord servers?
Add your server