Open
Description
When you try to use mappable and logical grouping the mappable fields won't work.
https://laravel.com/docs/8.x/queries#logical-grouping
class MyModel {
use Eloquence, Mappable;
protected $maps = [
'id' => 'myId',
'field1' => 'myField1',
'field2' => 'myField2',
'is_enabled' => 'enabled'
];
}
$this->queryBuilder = MyModel::query();
$this->queryBuilder->where('is_enabled', 1);
$this->queryBuilder->where(function ($query) use ($searchCriteria) {
$text = '%'.Arr::pull($searchCriteria, 'text').'%';
return $query->where('field1', 'LIKE', $text)
->orWhere('field2', 'LIKE', $text);
});
$this->queryBuilder->get();
Error:
SQLSTATE[42S22]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Invalid column name 'field1'.
Metadata
Metadata
Assignees
Labels
No labels