Replies: 1 comment 1 reply
-
i have the same problem, when i try to use the function attribute |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This
$term = $request->input('search'); $searchResults = (new Search()) ->registerModel(User::class, 'username', 'name', 'profession') ->registerModel(Recipe::class, 'recipe_name') ->perform($term);
Works with
$searchResults->count()
But this,
` $searchResults = (new Search())
->registerModel(User::class, function (ModelSearchAspect $userSearchAspect) use ($term) {
$userSearchAspect
->addSearchableAttribute('name')
->orWhereHas('profileDetail', function (Builder $query, $term) {
$query->whereRaw('LOWER(profession) like %' . mb_strtolower($term, 'UTF8') . '%');
})
doesn't work with
$searchResults->count()
.Error is
Call to undefined method Spatie\Searchable\Search::count()
Beta Was this translation helpful? Give feedback.
All reactions