Sofa/eloquence 在 null 上调用成员函数 make()

Sofa/eloquence Call to a member function make() on null

我正在使用Sofa/eloquence package

问题出在我使用搜索

$users = USER::search($input)->get();

我收到这个错误

production.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function make() on null in /var/www/test/vendor/sofa/eloquence/src/Builder.php:77

我在用laravel 5.3,口才5.3.3

我也已经将此添加到 config/app。php

Sofa\Eloquence\ServiceProvider::class,

在我的模型上

use Eloquence {replicate as private replicateEloquence;}
use Sluggable {replicate as private replicateSluggable;}

    public function replicate (array $except = null)
    {
         $this->replicateEloquence();
         $this->replicateSluggable();
    }
protected $searchableColumns = ['name'];

有什么想法吗?

您没有按照安装说明进行操作。

Add Eloquence trait to the model - it's entry point for other extensions and is required for them to work.

没有它,这将失败。

这解决了我的问题

php artisan config:clear
php artisan clear-compiled