Elasticsearch報Call to undefined xx makeAllSearchable()錯誤

helong3314發表於2021-11-06

使用命令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*/
     69protected static function throwBadMethodCallException($method)
     70{71throw 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*/
     69protected static function throwBadMethodCallException($method)
     70{71throw 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;
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章