I have a function that takes a string and does a (very broad) match for it against multiple fields (aka. almost all of my DB fields in the table). This seems somewhat kludgy, but it works; however, this is not my primary concern at the moment.
Is it possible to: show which 'orwhere' returned the record into collection? I would like to show (on the results view) what part of the record the string matched.
$apps = Application::all();
$apps->where('bill_company_name', 'like', '%'.$request->filter.'%');
$apps->orwhere('bill_address', 'like', '%'.$request->filter.'%');
$apps->orwhere('bill_city', 'like', '%'.$request->filter.'%');
...
$apps = $apps->paginate();
$apps->withPath('custom/url');
return $apps;
I know I could probably do this on the view (via some more code grepping the filter against the record again), but this option sounds even more laborious.
Thank you!