1 week ago

Spatie/Searchable giving error on query builder

Posted 1 week ago by DesignDepotNL

I have a search function inside my ProjectController that looks like this:

public function search(Request $request)	{

		$results = (new Search())->registerModel(Project::class, function(ModelSearchAspect $modelSearchAspect) {
		return response()->json($results);

However, this is giving me the error:

Call to undefined method Spatie\Searchable\ModelSearchAspect::with()

Even though i've imported the ModelSearchAspect like:

use Spatie\Searchable\ModelSearchAspect;

Any idea what might be going wrong? I'm clueless at this point.

Please sign in or create an account to participate in this conversation.