selahattinunlu / laravel-api-query-builder

Laravel & Lumen Api Query Builder Package
331 stars 66 forks source link

QueryBuilder->hasTableColumn does not respect DB connection #24

Open jesperbjerke opened 7 years ago

jesperbjerke commented 7 years ago

I have a multi-tenant database setup, and when trying to query a model I get "Unknown column 'id'". Turns out the method \Unlu\Laravel\Api\QueryBuilder::hasTableColumn calls Schema::hasColumn without setting connection first. Should be:

private function hasTableColumn($column)
{
    return (Schema::connection($this->model->getConnectionName())->hasColumn($this->model->getTable(), $column));
}
walliby commented 7 years ago

I am seeing this error as well when passing column names

markwalet commented 7 years ago

When are you fixing this?