/**
* @param string|Model $model
* @param string $query
* @param int|null $perPage
* @param string $pageName
*
* @return LengthAwarePaginator|Collection
* @throws \Exception
*/
public function searchIn($model, $query = "", $perPage = null, $pageName = 'page')
{
if ($model instanceof Model) {
$model = get_class($model);
}
if (!$this->models->offsetExists($model)) {
throw new \Exception("Search engine for model [{$model}] not found");
}
return $this->_search([$this->models->get($model)], $query = "", $perPage = null, $pageName = 'page');
}