douqie1852 2016-09-19 22:02
浏览 379
已采纳

BadMethodCallException:调用未定义的方法Illuminate \ Database \ Query \ Builder :: makeAllSearchable()

I am trying to run the command php artisan scout:import "App\User" to import user records into search driver as per documentation (Laravel 5.3 Scout Documentation). I keep getting [BadMethodCallException]
Call to undefined method Illuminate\Database\Query\Builder::makeAllSearchable() as an error. Why am I getting this error? I have included the searchable trait in my users controller and added the scout class to my app/config providers array, so I am struggling to see why the method doesn't exist...

  • 写回答

2条回答 默认 最新

  • doqrt26664 2016-09-19 22:05
    关注

    You should not add the trait to the controller but to the model. So in your case to App\User.php

    <?php
    
    namespace App;
    
    use Laravel\Scout\Searchable;
    use Illuminate\Database\Eloquent\Model;
    
    class User extends Model
    {
        use Searchable;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突