Closed AEK-BKF closed 3 years ago
The search scope for your model is up to you to define, it is not built into the package.
For example, here's one of mine for my users table that I put on my User model:
public function scopeSearch($query, $term)
{
return $query->where(
fn ($query) => $query->where('name', 'like', '%'.$term.'%')
->orWhere('email', 'like', '%'.$term.'%')
);
}
Ah Ok ! Thanks, I thought you're using a search package.
This was not immediately clear to me either, it may be worth giving an example of an actual SQL query in the docs like you did above.
Hey guys, I am working on a merge request to add some default search behavior like existed previously. Maybe it will help with confusion by allowing you to choose between a manual implementation or an out-of-box search implementation.
I'll make it more clear in the docs.
If this is approved: https://github.com/rappasoft/laravel-livewire-tables/pull/210/files
You would be able to use ->searchable() on columns like before. Of course, you would still be able to implement search as @rappasoft indicates and that may be more flexible for your needs.
Hello, First, I'd like to thank you for this awesome package. I'm trying to run this example : https://github.com/rappasoft/laravel-livewire-tables#example-table In search, I get this error :
BadMethodCallException, Call to undefined method Illuminate\Database\Eloquent\Builder::search()