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
Not at present, will be possible in V4 I believe
toeknee, thanks for answering.
Is there no way currently to implement some kind of filter between the Database and the table?
Maybe you can use Sushi https://usesushi.dev/
Sushi 🍣
Eloquent’s missing “array” driver.
Sometimes you just want to use Eloquent without a database.
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
You even could use sushi for that
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
You could overwrite the
getRecords()
method. I think that's the last method that gets called before data is passed to the viewWouldn't that screw the pagination?
Well you need to return the data in the same format as before 😅