Skip to content

Commit 249255b

Browse files
committed
orderByNestedDesc() - Updated model docs
1 parent 919eafe commit 249255b

File tree

2 files changed

+172
-66
lines changed

2 files changed

+172
-66
lines changed

src/Eloquent/Docs/ModelDocs.php

Lines changed: 167 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -15,114 +15,215 @@
1515
* Query Builder Methods ---------------------------------
1616
*
1717
* @method static Builder query()
18+
*-----------------------------------
1819
* @method static $this where($column, $operator = null, $value = null, $boolean = 'and', $options = [])
1920
* @method static $this whereNot($column, $operator = null, $value = null, $boolean = 'and', $options = [])
2021
* @method static $this orWhere($column, $operator = null, $value = null, $options = [])
2122
* @method static $this orWhereNot($column, $operator = null, $value = null, $options = [])
22-
* @method static $this whereRaw($dsl, $bindings = [], $boolean = 'and', $options = [])
23+
*-----------------------------------
2324
* @method static $this whereIn($column, $values, $boolean = 'and', $not = false, $options = [])
2425
* @method static $this whereNotIn($column, $values, $boolean = 'and', $options = [])
2526
* @method static $this orWhereIn($column, $values, $options = [])
2627
* @method static $this orWhereNotIn($column, $values, $options = [])
28+
*-----------------------------------
2729
* @method static $this whereNull($columns, $boolean = 'and', $not = false)
2830
* @method static $this whereNotNull($columns, $boolean = 'and')
2931
* @method static $this orWhereNull($columns)
3032
* @method static $this orWhereNotNull($columns)
33+
*-----------------------------------
3134
* @method static $this whereExact($column, $value, $boolean = 'and', $not = false, $options = [])
3235
* @method static $this whereNotExact($column, $value, $options = [])
3336
* @method static $this orWhereExact($column, $value, $options = [])
3437
* @method static $this orWhereNotExact($column, $value, $options = [])
35-
* @method static $this whereTermExists($column, $boolean = 'and', $not = false)
36-
* @method static $this whereNotTermExists($column)
37-
* @method static $this orWhereTermExists($column)
38-
* @method static $this orWhereNotTermsExists($column)
38+
*-----------------------------------
3939
* @method static $this whereFuzzy($column, $value, $boolean = 'and', $not = false, $options = [])
4040
* @method static $this whereNotFuzzy($column, $value, $options = [])
4141
* @method static $this orWhereFuzzy($column, $value, $options = [])
4242
* @method static $this orWhereNotFuzzy($column, $value, $options = [])
43+
*-----------------------------------
4344
* @method static $this wherePrefix($column, $value, $boolean = 'and', $not = false, $options = [])
4445
* @method static $this whereNotPrefix($column, $value, $options = [])
4546
* @method static $this orWherePrefix($column, $value, $options = [])
4647
* @method static $this orWhereNotPrefix($column, $value, $options = [])
47-
* @method static $this whereGeoBox($field, array $topLeft, array $bottomRight, $validationMethod = null, $boolean = 'and', bool $not = false)
48-
* @method static $this whereNotGeoBox($field, array $topLeft, array $bottomRight, $validationMethod = null)
49-
* @method static $this orWhereGeoBox($field, array $topLeft, array $bottomRight, $validationMethod = null)
50-
* @method static $this orWhereNotGeoBox($field, array $topLeft, array $bottomRight, $validationMethod = null)
51-
* @method static $this whereGeoDistance($field, string $distance, array $location, $distanceType = null, $validationMethod = null, $boolean = 'and', bool $not = false)
52-
* @method static $this whereNotGeoDistance($field, string $distance, array $location, $distanceType = null, $validationMethod = null)
53-
* @method static $this orWhereGeoDistance($field, string $distance, array $location, $distanceType = null, $validationMethod = null)
54-
* @method static $this orWhereNotGeoDistance($field, string $distance, array $location, $distanceType = null, $validationMethod = null)
48+
*-----------------------------------
49+
* @method static $this wherePhrase($column, $value, $boolean = 'and', $options = [])
50+
* @method static $this orWherePhrase($column, $value, $options = [])
51+
* @method static $this wherePhrasePrefix($column, $value, $boolean = 'and', $options = [])
52+
* @method static $this orWherePhrasePrefix($column, $value, $options = [])
53+
*-----------------------------------
54+
* @method static $this whereDate($column, $operator = null, $value = null, $boolean = 'and', $options = [])
55+
* @method static $this orWhereDate($column, $operator = null, $value = null, $options = [])
56+
* @method static $this whereTimestamp($column, $operator = null, $value = null, $boolean = 'and', $options = [])
57+
* @method static $this orWhereTimestamp($column, $operator = null, $value = null, $options = [])
58+
* @method static $this whereWeekday($column, $operator, $value = null, $boolean = 'and', $options = [])
59+
* @method static $this orWhereWeekday($column, $operator, $value = null, $options = [])
60+
*-----------------------------------
61+
* @method static $this whereRegex($column, $regex, $options = [])
62+
* @method static $this orWhereRegex($column, $regex, $options = [])
63+
*-----------------------------------
64+
* @method static $this whereBetween($column, $values, $boolean = 'and', $not = false, $options = [])
65+
* @method static $this whereNotBetween($column, $values, $boolean = 'and', $options = [])
66+
* @method static $this orWhereBetween($column, $values, $options = [])
67+
* @method static $this orWhereNotBetween($column, $values, $options = [])
68+
*-----------------------------------
69+
* @method static $this whereGeoBox($field, $topLeft, $bottomRight, $validationMethod = null, $boolean = 'and', $not = false)
70+
* @method static $this whereNotGeoBox($field, $topLeft, $bottomRight, $validationMethod = null)
71+
* @method static $this orWhereGeoBox($field, $topLeft, $bottomRight, $validationMethod = null)
72+
* @method static $this orWhereNotGeoBox($field, $topLeft, $bottomRight, $validationMethod = null)
73+
*-----------------------------------
74+
* @method static $this whereGeoDistance($field, $distance, $location, $distanceType = null, $validationMethod = null, $boolean = 'and', $not = false)
75+
* @method static $this whereNotGeoDistance($field, $distance, $location, $distanceType = null, $validationMethod = null)
76+
* @method static $this orWhereGeoDistance($field, $distance, $location, $distanceType = null, $validationMethod = null)
77+
* @method static $this orWhereNotGeoDistance($field, $distance, $location, $distanceType = null, $validationMethod = null)
78+
*-----------------------------------
5579
* @method static $this whereNestedObject($column, $query, $filterInnerHits = false, $options = [], $boolean = 'and', $not = false)
5680
* @method static $this whereNotNestedObject($column, $query, $filterInnerHits = false, $options = [])
5781
* @method static $this orWhereNestedObject($column, $query, $filterInnerHits = false, $options = [])
5882
* @method static $this orWhereNotNestedObject($column, $query, $filterInnerHits = false, $options = [])
59-
* @method static $this wherePhrase(string $column, string $value, $boolean = 'and', $options = [])
60-
* @method static $this wherePhrasePrefix(string $column, string $value, $boolean = 'and', $options = [])
61-
* @method static $this whereDate($column, $operator = null, $value = null, $boolean = 'and', $options = [])
62-
* @method static $this whereTimestamp($column, $operator = null, $value = null, $boolean = 'and', $options = [])
63-
* @method static $this whereRegex(string $column, string $regex, $options = [])
64-
* @method static $this orWherePhrase(string $column, string $value, $options = [])
65-
* @method static $this orWherePhrasePrefix(string $column, string $value, $options = [])
66-
* @method static $this orWhereDate($column, $operator = null, $value = null, $options = [])
67-
* @method static $this orWhereTimestamp($column, $operator = null, $value = null, $options = [])
68-
* @method static $this orWhereRegex(string $column, string $regex, $options = [])
69-
*
70-
* Filter and order methods ---------------------------------
71-
* @method static $this orderBy(string $column, string $direction = 'asc')
72-
* @method static $this orderByDesc(string $column)
73-
* @method static $this withSort(string $column, string $key, mixed $value)
74-
* @method static $this orderByGeo(string $column, array $pin, $direction = 'asc', $unit = 'km', $mode = null, $type = 'arc')
75-
* @method static $this orderByGeoDesc(string $column, array $pin, $unit = 'km', $mode = null, $type = 'arc')
76-
* @method static $this orderByNested(string $column, string $direction = 'asc', string $mode = null)
77-
* @method static $this filterGeoBox(string $column, array $topLeftCoords, array $bottomRightCoords)
78-
* @method static $this filterGeoPoint(string $column, string $distance, array $point)
79-
*
80-
* Full Text Search Methods ---------------------------------
81-
* @method static $this searchFor($value, $fields = ['*'], $options = [], $boolean = 'and')
83+
*-----------------------------------
84+
* @method static $this whereTermExists($column, $boolean = 'and', $not = false)
85+
* @method static $this whereNotTermExists($column)
86+
* @method static $this orWhereTermExists($column)
87+
* @method static $this orWhereNotTermsExists($column)
88+
*-----------------------------------
89+
* @method static $this whereRaw($dsl, $bindings = [], $boolean = 'and', $options = [])
90+
*===========================================
91+
* Full Text Search Methods
92+
*===========================================
8293
* @method static $this searchTerm($term, $fields = ['*'], $options = [], $boolean = 'and')
83-
* @method static $this searchTermMost($term, $fields = ['*'], $options = [], $boolean = 'and')
84-
* @method static $this searchTermCross($term, $fields = ['*'], $options = [], $boolean = 'and')
85-
* @method static $this searchPhrase($phrase, $fields = ['*'], $options = [], $boolean = 'and')
86-
* @method static $this searchPhrasePrefix($phrase, $fields = ['*'], $options = [], $boolean = 'and')
87-
* @method static $this searchBoolPrefix($phrase, $fields = ['*'], $options = [], $boolean = 'and')
88-
* @method static $this orSearchFor($value, $fields = ['*'], $options = [])
8994
* @method static $this orSearchTerm($term, $fields = ['*'], $options = [])
95+
* @method static $this searchNotTerm($term, $fields = ['*'], $options = [])
96+
* @method static $this orSearchNotTerm($term, $fields = ['*'], $options = [])
97+
*-----------------------------------
98+
* @method static $this searchTermMost($term, $fields = ['*'], $options = [], $boolean = 'and')
9099
* @method static $this orSearchTermMost($term, $fields = ['*'], $options = [])
100+
* @method static $this searchNotTermMost($term, $fields = ['*'], $options = [])
101+
* @method static $this orSearchNotTermMost($term, $fields = ['*'], $options = [])
102+
*-----------------------------------
103+
* @method static $this searchTermCross($term, $fields = ['*'], $options = [], $boolean = 'and')
91104
* @method static $this orSearchTermCross($term, $fields = ['*'], $options = [])
105+
* @method static $this searchNotTermCross($term, $fields = ['*'], $options = [])
106+
* @method static $this orSearchNotTermCross($term, $fields = ['*'], $options = [])
107+
*-----------------------------------
108+
* @method static $this searchPhrase($phrase, $fields = ['*'], $options = [], $boolean = 'and')
92109
* @method static $this orSearchPhrase($phrase, $fields = ['*'], $options = [])
110+
* @method static $this searchNotPhrase($phrase, $fields = ['*'], $options = [])
111+
* @method static $this orSearchNotPhrase($phrase, $fields = ['*'], $options = [])
112+
*-----------------------------------
113+
* @method static $this searchPhrasePrefix($phrase, $fields = ['*'], $options = [], $boolean = 'and')
93114
* @method static $this orSearchPhrasePrefix($phrase, $fields = ['*'], $options = [])
115+
* @method static $this searchNotPhrasePrefix($phrase, $fields = ['*'], $options = [])
116+
* @method static $this orSearchNotPhrasePrefix($phrase, $fields = ['*'], $options = [])
117+
*-----------------------------------
118+
* @method static $this searchBoolPrefix($phrase, $fields = ['*'], $options = [], $boolean = 'and')
94119
* @method static $this orSearchBoolPrefix($phrase, $fields = ['*'], $options = [])
95-
* @method static $this highlight(array $fields = [], string|array $preTag = '<em>', string|array $postTag = '</em>', array $globalOptions = [])
120+
*-----------------------------------
121+
* @method static $this searchFuzzy($term, $fields = ['*'], $options = [])
122+
* @method static $this orSearchFuzzy($term, $fields = ['*'], $options = [])
123+
* @method static $this searchNotFuzzy($term, $fields = ['*'], $options = [])
124+
* @method static $this orSearchNotFuzzy($term, $fields = ['*'], $options = [])
125+
*-----------------------------------
126+
* @method static $this searchFuzzyPrefix($term, $fields = ['*'], $options = [])
127+
* @method static $this orSearchFuzzyPrefix($term, $fields = ['*'], $options = [])
128+
* @method static $this searchNotFuzzyPrefix($term, $fields = ['*'], $options = [])
129+
* @method static $this orSearchNotFuzzyPrefix($term, $fields = ['*'], $options = [])
130+
*===========================================
131+
* Speciality methods
132+
*===========================================
133+
* @method static $this whereScript($script, $options = [], $boolean = 'and')
134+
* @method static $this orWhereScript($script, $options = [])
135+
*-----------------------------------
136+
* @method static $this highlight($fields = [], $preTag = '<em>', $postTag = '</em>', $globalOptions = [])
96137
* @method static $this withoutRefresh()
97-
*
98-
* Query Executors --------------------------------------------
138+
*-----------------------------------
139+
* @method static $this whereChild($documentType, $callback, $options = [], $boolean = 'and')
140+
* @method static $this whereParent($documentType, $callback, $options = [], $boolean = 'and')
141+
* @method static $this whereParentId($parentType, $id, $boolean = 'and')
142+
*-----------------------------------
143+
* @method static $this excludeFields($fields)
144+
* @method static $this withAnalyzer($analyzer)
145+
* @method static $this withMinScore($val)
146+
* @method static $this withSuffix($suffix)
147+
*-----------------------------------
148+
* @method static $this routing($routing)
149+
* @method static $this parentId($id)
150+
*-----------------------------------
151+
* @method static $this proceedOnConflicts()
152+
* @method static $this onConflicts($option = 'proceed')
153+
*-----------------------------------
154+
* @method static $this push($column, $value = null, $unique = false)
155+
* @method static $this pull($column, $value = null)
156+
*-----------------------------------
157+
* @method static $this incrementEach($columns, $extra = [])
158+
* @method static $this decrementEach($columns, $extra = [])
159+
*===========================================
160+
* Filter and order methods
161+
*===========================================
162+
* @method static $this orderBy($column, $direction = 'asc')
163+
* @method static $this orderByDesc($column)
164+
*-----------------------------------
165+
* @method static $this groupBy($groups)
166+
*-----------------------------------
167+
* @method static $this orderByGeo($column, $pin, $direction = 'asc', $options = [])
168+
* @method static $this orderByGeoDesc($column, $pin, $options = [])
169+
*-----------------------------------
170+
* @method static $this orderByNested($column, $direction = 'asc', $mode = null)
171+
* @method static $this orderByNestedDesc($column, $direction = 'asc', $mode = null)
172+
*-----------------------------------
173+
* @method static $this withSort($column, $key, $value)
174+
*===========================================
175+
* Executors
176+
*===========================================
99177
* @method static Model|null find($id)
100-
* @method static array getModels(array $columns = ['*'])
101-
* @method static ElasticCollection get(array $columns = ['*'])
102-
* @method static Model|null first(array $columns = ['*'])
103-
* @method static Model firstOrCreate(array $attributes, array $values = [])
104-
* @method static int|array sum(array|string $columns)
105-
* @method static int|array min(array|string $columns)
106-
* @method static int|array max(array|string $columns)
107-
* @method static int|array avg(array|string $columns)
178+
* @method static Model|null first($columns = ['*'])
179+
* @method static Model firstOrCreate($attributes, $values = [])
180+
*-----------------------------------
181+
* @method static array getModels($columns = ['*'])
182+
* @method static ElasticCollection get($columns = ['*'])
183+
* @method static ElasticCollection insert($values, $returnData = null)
184+
*-----------------------------------
185+
* @method static array toDsl($columns = ['*'])
186+
* @method static array toSql($columns = ['*'])
187+
*-----------------------------------
188+
* @method static mixed rawDsl($bodyParams)
189+
* @method static ElasticCollection rawSearch($bodyParams)
190+
* @method static array rawAggregation($bodyParams)
191+
*-----------------------------------
192+
* @method static LengthAwarePaginator paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null, $total = null)
193+
* @method static SearchAfterPaginator cursorPaginate($perPage = null, $columns = [], $cursorName = 'cursor', $cursor = null)
194+
*-----------------------------------
195+
* @method static bool chunk($count, $callback)
196+
* @method static bool chunkById($count, $callback, $column = '_id', $alias = null)
197+
* -----------------------------------
198+
* @method static ElasticCollection distinct($columns = [], $includeCount = false)
199+
*===========================================
200+
* Aggregators Methods
201+
*===========================================
202+
* @method static int|array sum($columns)
203+
* @method static int|array min($columns)
204+
* @method static int|array max($columns)
205+
* @method static int|array avg($columns)
108206
* @method static mixed agg(array $functions, $column)
109-
* @method static LengthAwarePaginator paginate(int $perPage = 15, array $columns = ['*'], string $pageName = 'page', ?int $page = null, ?int $total = null)
110-
* @method static SearchAfterPaginator cursorPaginate(int|null $perPage = null, array $columns = [], string $cursorName = 'cursor', ?Cursor $cursor = null)
111-
* @method static ElasticCollection insert($values, $returnData = null):
112-
* @method static array toDsl(array $columns = ['*'])
113-
* @method static array toSql(array $columns = ['*'])
114-
* @method static mixed rawDsl(array $bodyParams)
115-
* @method static ElasticCollection rawSearch(array $bodyParams)
116-
* @method static array rawAggregation(array $bodyParams)
117-
* @method static bool chunk(mixed $count, callable $callback, string $keepAlive = '5m')
118-
* @method static bool chunkById(mixed $count, callable $callback, $column = '_id', $alias = null, $keepAlive = '5m')
119-
*
120-
* Index Methods ---------------------------------
207+
*-----------------------------------
208+
* @method static mixed boxplot($columns, $options = [])
209+
* @method static mixed cardinality($columns, $options = [])
210+
* @method static mixed extendedStats($columns, $options = [])
211+
* @method static mixed matrix($columns, $options = [])
212+
* @method static mixed medianAbsoluteDeviation($columns, $options = [])
213+
* @method static mixed percentiles($columns, $options = [])
214+
* @method static mixed stats($columns, $options = [])
215+
* @method static mixed stringStats( $columns, $options = [])
216+
*-----------------------------------
217+
* @method static array getAggregationResults()
218+
* @method static array getRawAggregationResults()
219+
*===========================================
220+
* Index Methods
221+
*===========================================
121222
* @method static void truncate()
122223
* @method static bool indexExists()
123224
* @method static bool deleteIndexIfExists()
124225
* @method static bool deleteIndex()
125-
* @method static bool createIndex(array $options = [])
226+
* @method static bool createIndex($callback)
126227
* @method static array getIndexMappings()
127228
* @method static array getFieldMapping(string|array $field = '*', $raw = false)
128229
* @method static array getIndexOptions()

src/Query/Builder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,6 +1591,11 @@ public function orderByNested(string $column, $direction = 1, string $mode = 'av
15911591
return $this->orderBy($column, $direction, $options);
15921592
}
15931593

1594+
public function orderByNestedDesc(string $column, string $mode = 'avg'): self
1595+
{
1596+
return $this->orderByNested($column, 'desc', $mode);
1597+
}
1598+
15941599
public function withSort(string $column, $key, $value): self
15951600
{
15961601
$this->sorts[$column] = [$key => $value];

0 commit comments

Comments
 (0)