Exemplo n.º 1
0
 public function getPresenter()
 {
     return \App::make(DragonPresenter::class, [$this]);
 }
Exemplo n.º 2
0
 /**
  * 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);
 }
Exemplo n.º 3
0
 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');
 }