V
V
Vladislav2019-05-24 12:24:54
PostgreSQL
Vladislav, 2019-05-24 12:24:54

Why doesn't scout:import work?

There is a table with various fields + searchable field.
Model code:

use  Searchable;
    protected $table = "okved_h_section";
    public $timestamps = false;

    protected $fillable = [
        'id',
        'name',
        'code',
        'searchable'
    ];

    public function searchableAs()
    {
        return "okved_h_section";
    }

    public function toSearchableArray()
    {
        $array = [
            'section' => $this->code,
            'title_section' => $this->name
        ];

        return $array;
    }

I write code
php artisan scout:import "\App\Models\OkvedSection"

the following error comes up
Illuminate\Database\QueryException  : SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "okved_h_section" does not exist
LINE 1: update "okved_h_section" set "searchable" = $1 where "id" = ...
               ^ (SQL: update "okved_h_section" set "searchable" = 'лесн':2 'охот':4 'рыбоводств':7 'рыболовств':5 'сельск':1 'хозяйств':3 where "id"
= 1)

As I understand it, he does not see the table. There is a connection to the database, all settings are correct. What's my mistake?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2019-05-24
@vos_50

Hmm, I'm dumb, in the scout settings I specified a connection to the wrong database from here and an error)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question