コード例 #1
0
ファイル: Dragon.php プロジェクト: rickselby/dragons-helper
 public function getPresenter()
 {
     return \App::make(DragonPresenter::class, [$this]);
 }
コード例 #2
0
ファイル: IndexModel.php プロジェクト: hlmasterchief/plock
 /**
  * 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);
 }
コード例 #3
0
 public function getPresenter()
 {
     return \App::make(CollectTimesPresenter::class, [$this]);
 }
コード例 #4
0
 public function __construct(array $attributes = array(), Validator $validator = null)
 {
     parent::__construct($attributes);
     $this->validator = $validator ?: \App::make('validator');
 }