scout-elasticsearch-driver
scout-elasticsearch-driver copied to clipboard
Add getModel to Builder
trafficstars
Fix not exists getModel method in Builder
Why do you need it in Builder? What's the use case?
@babenkoivan I use 2 types of filters in my application - ES and Postgresql. Depending on whether there is a search method in the model or not, I further define the search logic. So far I have to use this code, which is not very beautiful:
private function getModel($builder)
{
if (!($builder instanceof Illuminate\Database\Eloquent\Builder)) {
return $builder->model;
}
return $builder->getModel();
}
if (method_exists($this->getModel($builder), 'search')) {
//my code
}
This is a typo of the century)))