I'm setting up Laravel Scout for searching (experimenting with Meilisearch as the driver), however, I want to limit what fields are used for search (and ideally which fields are returned) based on a users permissions.
As an example, a User
model might have the following fields:
id: 5,
name: John,
email: john.doe@hotmail.com,
phone: 0412345678
I'd like everyone to be able to search by name
and email
, however I want to limit searching by phone number
to only authorised users (eg. admins)
I've not been able to find any ways to limit what fields are searched/returned dynamically. I've only been able to find ways to limit what is initially sent to the index.
(on a slight tangent, is it possible to get the weighting of the search returned as well?)