1 | <?php |
||
18 | class ElasticsearchModel extends Model |
||
19 | { |
||
20 | use Elasticsearchable, Paginationable, Relationshipable; |
||
21 | |||
22 | /** |
||
23 | * @var ElasticsearchDAL |
||
24 | */ |
||
25 | public $_dal; |
||
26 | |||
27 | 54 | public function __construct(IDAL $dal, array $attributes = []) |
|
33 | |||
34 | 4 | public static function findWithParentId($id, $parent, array $columns = ['*']) |
|
38 | |||
39 | /** |
||
40 | * Execute the query and get the result. |
||
41 | * |
||
42 | * @param QueryBuilder|array $query |
||
43 | * @return ElasticsearchCollection|static[] |
||
44 | */ |
||
45 | 22 | public static function search($query = []) |
|
53 | |||
54 | /** |
||
55 | * Execute the query and get the first result. |
||
56 | * |
||
57 | * @param QueryBuilder|array $query |
||
58 | * @return static |
||
59 | */ |
||
60 | 2 | public static function first($query = []) |
|
69 | |||
70 | /** |
||
71 | * Execute the query and get the first result or throw an exception. |
||
72 | * |
||
73 | * @param QueryBuilder|array $query |
||
74 | * @throws ModelNotFoundException |
||
75 | * @return static |
||
76 | */ |
||
77 | public static function firstOrFail($query = []) |
||
85 | |||
86 | /** |
||
87 | * Apply the callback to the documents of the given query. |
||
88 | * |
||
89 | * @param QueryBuilder|array $query |
||
90 | * @param callable $callback |
||
91 | * @param int $limit |
||
92 | * @return int hits.total |
||
93 | */ |
||
94 | 6 | public static function map($query = [], callable $callback = null, $limit = -1) |
|
125 | |||
126 | /** |
||
127 | * Execute the query and get all items. |
||
128 | * |
||
129 | * @param QueryBuilder|array $query |
||
130 | * @return Collection |
||
131 | */ |
||
132 | 2 | public static function all($query = []) |
|
143 | |||
144 | 6 | protected function belongsTo($class) |
|
148 | |||
149 | 4 | protected function hasMany($class) |
|
153 | } |
||
154 |