Elasticsearch报Call to undefined xx makeAllSearchable()错误

北极星
阅读 306 标签:php  Elasticsearch  

使用命令 php artisan scout:import “App\Province”

> BadMethodCallException 

  Call to undefined method Modules\Basis\Entities\Province::makeAllSearchable()

  at vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:71
     67▕      * @throws \BadMethodCallException
     68▕      */
     69▕     protected static function throwBadMethodCallException($method)
     70▕     {
  ➜  71▕         throw new BadMethodCallException(sprintf(
     72▕             'Call to undefined method %s::%s()', static::class, $method
     73▕         ));
     74▕     }
     75▕ }

  • Bad Method Call: Did you mean Modules\Basis\Entities\Province::searchableAs() ? 

      +17 vendor frames 
  18  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
macdeimac:rbac mac$ php artisan scout:import "Modules\Basis\Entities\Province"

   BadMethodCallException 

  Call to undefined method Modules\Basis\Entities\Province::makeAllSearchable()

  at vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:71
     67▕      * @throws \BadMethodCallException
     68▕      */
     69▕     protected static function throwBadMethodCallException($method)
     70▕     {
  ➜  71▕         throw new BadMethodCallException(sprintf(
     72▕             'Call to undefined method %s::%s()', static::class, $method
     73▕         ));
     74▕     }
     75▕ }

>   • Bad Method Call: Did you mean Modules\Basis\Entities\Province::searchableAs() ? 

报这个错误,主要是 Searchable 类 未使用 use Searchable 类就解决问题

use Searchable;
文章来源:网络 版权归原作者所有,如涉及知识产权问题,请权利人联系我们,我们将立即处理.
北极星
文章 40 获得 0个赞 共 0个粉丝

推荐阅读 更多精彩内容