public function getPresenter() { return \App::make(DragonPresenter::class, [$this]); }
/** * Search by elasticsearch * @return Model */ public function elasticSearch(array $options) { $es = \App::make('elasticsearch'); $params = ["index" => $this->getElasticIndex(), "type" => $this->getElasticType(), "body" => ["query" => ["bool" => ["must" => []]]]]; $results = []; foreach ($options as $key => $value) { $params["body"]["query"]["bool"]["must"][] = ["match" => [$key => $value]]; } try { $search = $es->search($params); } catch (Exception $e) { return mull; } foreach ($search["hits"]["hits"] as $key => $value) { $results[] = $this->find($value["_source"]["id"]); } return collect($results); }
public function getPresenter() { return \App::make(CollectTimesPresenter::class, [$this]); }
public function __construct(array $attributes = array(), Validator $validator = null) { parent::__construct($attributes); $this->validator = $validator ?: \App::make('validator'); }