This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Recca0120\Repository\Concerns; |
||
4 | |||
5 | use Closure; |
||
6 | use Illuminate\Database\Query\Builder; |
||
7 | use Recca0120\Repository\Method; |
||
8 | |||
9 | trait BuildsQueries |
||
10 | { |
||
11 | /** |
||
12 | * Set the columns to be selected. |
||
13 | * |
||
14 | * @param array|mixed $columns |
||
15 | * @return $this |
||
16 | */ |
||
17 | 1 | public function select($columns = ['*']) |
|
18 | { |
||
19 | 1 | $this->methods[] = new Method(__FUNCTION__, [$columns]); |
|
0 ignored issues
–
show
|
|||
20 | |||
21 | 1 | return $this; |
|
22 | } |
||
23 | |||
24 | /** |
||
25 | * Add a new "raw" select expression to the query. |
||
26 | * |
||
27 | * @param string $expression |
||
28 | * @param array $bindings |
||
29 | * @return $this |
||
30 | */ |
||
31 | 1 | public function selectRaw($expression, array $bindings = []) |
|
32 | { |
||
33 | 1 | $this->methods[] = new Method(__FUNCTION__, [$expression, $bindings]); |
|
34 | |||
35 | 1 | return $this; |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * Makes "from" fetch from a subquery. |
||
40 | * |
||
41 | * @param \Closure|\Illuminate\Database\Query\Builder|string $query |
||
42 | * @param string $as |
||
43 | * @return \Illuminate\Database\Query\Builder|static |
||
44 | * |
||
45 | * @throws \InvalidArgumentException |
||
46 | */ |
||
47 | public function fromSub($query, $as) |
||
48 | { |
||
49 | $this->methods[] = new Method(__FUNCTION__, [$query, $as]); |
||
50 | |||
51 | return $this; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Add a subselect expression to the query. |
||
56 | * |
||
57 | * @param \Closure|\Illuminate\Database\Query\Builder|string $query |
||
58 | * @param string $as |
||
59 | * @return $this |
||
60 | * |
||
61 | * @throws \InvalidArgumentException |
||
62 | */ |
||
63 | 1 | public function selectSub($query, $as) |
|
64 | { |
||
65 | 1 | $this->methods[] = new Method(__FUNCTION__, [$query, $as]); |
|
66 | |||
67 | 1 | return $this; |
|
68 | } |
||
69 | |||
70 | /** |
||
71 | * Add a new select column to the query. |
||
72 | * |
||
73 | * @param array|mixed $column |
||
74 | * @return $this |
||
75 | */ |
||
76 | 1 | public function addSelect($column) |
|
77 | { |
||
78 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column]); |
|
79 | |||
80 | 1 | return $this; |
|
81 | } |
||
82 | |||
83 | /** |
||
84 | * Force the query to only return distinct results. |
||
85 | * |
||
86 | * @return $this |
||
87 | */ |
||
88 | 1 | public function distinct() |
|
89 | { |
||
90 | 1 | $this->methods[] = new Method(__FUNCTION__); |
|
91 | |||
92 | 1 | return $this; |
|
93 | } |
||
94 | |||
95 | /** |
||
96 | * Set the table which the query is targeting. |
||
97 | * |
||
98 | * @param string $table |
||
99 | * @return $this |
||
100 | */ |
||
101 | 1 | public function from($table) |
|
102 | { |
||
103 | 1 | $this->methods[] = new Method(__FUNCTION__, [$table]); |
|
104 | |||
105 | 1 | return $this; |
|
106 | } |
||
107 | |||
108 | /** |
||
109 | * Add a join clause to the query. |
||
110 | * |
||
111 | * @param string $table |
||
112 | * @param string $first |
||
113 | * @param string $operator |
||
114 | * @param string $second |
||
115 | * @param string $type |
||
116 | * @param bool $where |
||
117 | * @return $this |
||
118 | */ |
||
119 | 1 | public function join($table, $first, $operator = null, $second = null, $type = 'inner', $where = false) |
|
120 | { |
||
121 | 1 | $this->methods[] = new Method(__FUNCTION__, [$table, $first, $operator, $second, $type, $where]); |
|
122 | |||
123 | 1 | return $this; |
|
124 | } |
||
125 | |||
126 | /** |
||
127 | * Add a "join where" clause to the query. |
||
128 | * |
||
129 | * @param string $table |
||
130 | * @param string $first |
||
131 | * @param string $operator |
||
132 | * @param string $second |
||
133 | * @param string $type |
||
134 | * @return $this |
||
135 | */ |
||
136 | 1 | public function joinWhere($table, $first, $operator, $second, $type = 'inner') |
|
137 | { |
||
138 | 1 | $this->methods[] = new Method(__FUNCTION__, [$table, $first, $operator, $second, $type]); |
|
139 | |||
140 | 1 | return $this; |
|
141 | } |
||
142 | |||
143 | /** |
||
144 | * Add a subquery join clause to the query. |
||
145 | * |
||
146 | * @param \Closure|\Illuminate\Database\Query\Builder|string $query |
||
147 | * @param string $as |
||
148 | * @param string $first |
||
149 | * @param string|null $operator |
||
150 | * @param string|null $second |
||
151 | * @param string $type |
||
152 | * @param bool $where |
||
153 | * @return \Illuminate\Database\Query\Builder|static |
||
154 | * |
||
155 | * @throws \InvalidArgumentException |
||
156 | */ |
||
157 | public function joinSub($query, $as, $first, $operator = null, $second = null, $type = 'inner', $where = false) |
||
158 | { |
||
159 | $this->methods[] = new Method(__FUNCTION__, [$query, $as, $first, $operator, $second, $type, $where]); |
||
160 | |||
161 | return $this; |
||
162 | } |
||
163 | |||
164 | /** |
||
165 | * Add a left join to the query. |
||
166 | * |
||
167 | * @param string $table |
||
168 | * @param string $first |
||
169 | * @param string $operator |
||
170 | * @param string $second |
||
171 | * @return $this |
||
172 | */ |
||
173 | 1 | public function leftJoin($table, $first, $operator = null, $second = null) |
|
174 | { |
||
175 | 1 | $this->methods[] = new Method(__FUNCTION__, [$table, $first, $operator, $second]); |
|
176 | |||
177 | 1 | return $this; |
|
178 | } |
||
179 | |||
180 | /** |
||
181 | * Add a "join where" clause to the query. |
||
182 | * |
||
183 | * @param string $table |
||
184 | * @param string $first |
||
185 | * @param string $operator |
||
186 | * @param string $second |
||
187 | * @return $this |
||
188 | */ |
||
189 | 1 | public function leftJoinWhere($table, $first, $operator, $second) |
|
190 | { |
||
191 | 1 | $this->methods[] = new Method(__FUNCTION__, [$table, $first, $operator, $second]); |
|
192 | |||
193 | 1 | return $this; |
|
194 | } |
||
195 | |||
196 | /** |
||
197 | * Add a subquery left join to the query. |
||
198 | * |
||
199 | * @param \Closure|\Illuminate\Database\Query\Builder|string $query |
||
200 | * @param string $as |
||
201 | * @param string $first |
||
202 | * @param string|null $operator |
||
203 | * @param string|null $second |
||
204 | * @return \Illuminate\Database\Query\Builder|static |
||
205 | */ |
||
206 | public function leftJoinSub($query, $as, $first, $operator = null, $second = null) |
||
207 | { |
||
208 | $this->methods[] = new Method(__FUNCTION__, [$query, $as, $first, $operator, $second]); |
||
209 | |||
210 | return $this; |
||
211 | } |
||
212 | |||
213 | /** |
||
214 | * Add a right join to the query. |
||
215 | * |
||
216 | * @param string $table |
||
217 | * @param string $first |
||
218 | * @param string $operator |
||
219 | * @param string $second |
||
220 | * @return $this |
||
221 | */ |
||
222 | 1 | public function rightJoin($table, $first, $operator = null, $second = null) |
|
223 | { |
||
224 | 1 | $this->methods[] = new Method(__FUNCTION__, [$table, $first, $operator, $second]); |
|
225 | |||
226 | 1 | return $this; |
|
227 | } |
||
228 | |||
229 | /** |
||
230 | * Add a "right join where" clause to the query. |
||
231 | * |
||
232 | * @param string $table |
||
233 | * @param string $first |
||
234 | * @param string $operator |
||
235 | * @param string $second |
||
236 | * @return $this |
||
237 | */ |
||
238 | 1 | public function rightJoinWhere($table, $first, $operator, $second) |
|
239 | { |
||
240 | 1 | $this->methods[] = new Method(__FUNCTION__, [$table, $first, $operator, $second]); |
|
241 | |||
242 | 1 | return $this; |
|
243 | } |
||
244 | |||
245 | /** |
||
246 | * Add a subquery right join to the query. |
||
247 | * |
||
248 | * @param \Closure|\Illuminate\Database\Query\Builder|string $query |
||
249 | * @param string $as |
||
250 | * @param string $first |
||
251 | * @param string|null $operator |
||
252 | * @param string|null $second |
||
253 | * @return \Illuminate\Database\Query\Builder|static |
||
254 | */ |
||
255 | public function rightJoinSub($query, $as, $first, $operator = null, $second = null) |
||
256 | { |
||
257 | $this->methods[] = new Method(__FUNCTION__, [$query, $as, $first, $operator, $second]); |
||
258 | |||
259 | return $this; |
||
260 | } |
||
261 | |||
262 | /** |
||
263 | * Add a "cross join" clause to the query. |
||
264 | * |
||
265 | * @param string $table |
||
266 | * @param string $first |
||
267 | * @param string $operator |
||
268 | * @param string $second |
||
269 | * @return $this |
||
270 | */ |
||
271 | 1 | public function crossJoin($table, $first = null, $operator = null, $second = null) |
|
272 | { |
||
273 | 1 | $this->methods[] = new Method(__FUNCTION__, [$table, $first, $operator, $second]); |
|
274 | |||
275 | 1 | return $this; |
|
276 | } |
||
277 | |||
278 | /** |
||
279 | * Merge an array of where clauses and bindings. |
||
280 | * |
||
281 | * @param array $wheres |
||
282 | * @param array $bindings |
||
283 | * @return void |
||
284 | */ |
||
285 | public function mergeWheres($wheres, $bindings) |
||
286 | { |
||
287 | $this->methods[] = new Method(__FUNCTION__, [$wheres, $bindings]); |
||
288 | |||
289 | return $this; |
||
290 | } |
||
291 | |||
292 | /** |
||
293 | * Pass the query to a given callback. |
||
294 | * |
||
295 | * @param \Closure $callback |
||
296 | * @return $this |
||
297 | */ |
||
298 | 1 | public function tap($callback) |
|
299 | { |
||
300 | 1 | $this->methods[] = new Method(__FUNCTION__, [$callback]); |
|
301 | |||
302 | 1 | return $this; |
|
303 | } |
||
304 | |||
305 | /** |
||
306 | * Add a basic where clause to the query. |
||
307 | * |
||
308 | * @param string|array|\Closure $column |
||
309 | * @param string $operator |
||
310 | * @param mixed $value |
||
311 | * @param string $boolean |
||
312 | * @return $this |
||
313 | */ |
||
314 | 12 | public function where($column, $operator = null, $value = null, $boolean = 'and') |
|
315 | { |
||
316 | 12 | $this->methods[] = new Method(__FUNCTION__, [$column, $operator, $value, $boolean]); |
|
317 | |||
318 | 12 | return $this; |
|
319 | } |
||
320 | |||
321 | /** |
||
322 | * Add an "or where" clause to the query. |
||
323 | * |
||
324 | * @param \Closure|string $column |
||
325 | * @param string $operator |
||
326 | * @param mixed $value |
||
327 | * @return $this |
||
328 | */ |
||
329 | 1 | public function orWhere($column, $operator = null, $value = null) |
|
330 | { |
||
331 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $operator, $value]); |
|
332 | |||
333 | 1 | return $this; |
|
334 | } |
||
335 | |||
336 | /** |
||
337 | * Add a "where" clause comparing two columns to the query. |
||
338 | * |
||
339 | * @param string|array $first |
||
340 | * @param string|null $operator |
||
341 | * @param string|null $second |
||
342 | * @param string|null $boolean |
||
343 | * @return $this |
||
344 | */ |
||
345 | 1 | public function whereColumn($first, $operator = null, $second = null, $boolean = 'and') |
|
346 | { |
||
347 | 1 | $this->methods[] = new Method(__FUNCTION__, [$first, $operator, $second, $boolean]); |
|
348 | |||
349 | 1 | return $this; |
|
350 | } |
||
351 | |||
352 | /** |
||
353 | * Add an "or where" clause comparing two columns to the query. |
||
354 | * |
||
355 | * @param string|array $first |
||
356 | * @param string|null $operator |
||
357 | * @param string|null $second |
||
358 | * @return $this |
||
359 | */ |
||
360 | 1 | public function orWhereColumn($first, $operator = null, $second = null) |
|
361 | { |
||
362 | 1 | $this->methods[] = new Method(__FUNCTION__, [$first, $operator, $second]); |
|
363 | |||
364 | 1 | return $this; |
|
365 | } |
||
366 | |||
367 | /** |
||
368 | * Add a raw where clause to the query. |
||
369 | * |
||
370 | * @param string $sql |
||
371 | * @param mixed $bindings |
||
372 | * @param string $boolean |
||
373 | * @return $this |
||
374 | */ |
||
375 | 1 | public function whereRaw($sql, $bindings = [], $boolean = 'and') |
|
376 | { |
||
377 | 1 | $this->methods[] = new Method(__FUNCTION__, [$sql, $bindings, $boolean]); |
|
378 | |||
379 | 1 | return $this; |
|
380 | } |
||
381 | |||
382 | /** |
||
383 | * Add a raw or where clause to the query. |
||
384 | * |
||
385 | * @param string $sql |
||
386 | * @param array $bindings |
||
387 | * @return $this |
||
388 | */ |
||
389 | 1 | public function orWhereRaw($sql, array $bindings = []) |
|
390 | { |
||
391 | 1 | $this->methods[] = new Method(__FUNCTION__, [$sql, $bindings]); |
|
392 | |||
393 | 1 | return $this; |
|
394 | } |
||
395 | |||
396 | /** |
||
397 | * Add a "where in" clause to the query. |
||
398 | * |
||
399 | * @param string $column |
||
400 | * @param mixed $values |
||
401 | * @param string $boolean |
||
402 | * @param bool $not |
||
403 | * @return $this |
||
404 | */ |
||
405 | 3 | public function whereIn($column, $values, $boolean = 'and', $not = false) |
|
406 | { |
||
407 | 3 | $this->methods[] = new Method(__FUNCTION__, [$column, $values, $boolean, $not]); |
|
408 | |||
409 | 3 | return $this; |
|
410 | } |
||
411 | |||
412 | /** |
||
413 | * Add an "or where in" clause to the query. |
||
414 | * |
||
415 | * @param string $column |
||
416 | * @param mixed $values |
||
417 | * @return $this |
||
418 | */ |
||
419 | 2 | public function orWhereIn($column, $values) |
|
420 | { |
||
421 | 2 | $this->methods[] = new Method(__FUNCTION__, [$column, $values]); |
|
422 | |||
423 | 2 | return $this; |
|
424 | } |
||
425 | |||
426 | /** |
||
427 | * Add a "where not in" clause to the query. |
||
428 | * |
||
429 | * @param string $column |
||
430 | * @param mixed $values |
||
431 | * @param string $boolean |
||
432 | * @return $this |
||
433 | */ |
||
434 | 1 | public function whereNotIn($column, $values, $boolean = 'and') |
|
435 | { |
||
436 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $values, $boolean]); |
|
437 | |||
438 | 1 | return $this; |
|
439 | } |
||
440 | |||
441 | /** |
||
442 | * Add an "or where not in" clause to the query. |
||
443 | * |
||
444 | * @param string $column |
||
445 | * @param mixed $values |
||
446 | * @return $this |
||
447 | */ |
||
448 | 1 | public function orWhereNotIn($column, $values) |
|
449 | { |
||
450 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $values]); |
|
451 | |||
452 | 1 | return $this; |
|
453 | } |
||
454 | |||
455 | /** |
||
456 | * Add a "where null" clause to the query. |
||
457 | * |
||
458 | * @param string $column |
||
459 | * @param string $boolean |
||
460 | * @param bool $not |
||
461 | * @return $this |
||
462 | */ |
||
463 | 1 | public function whereNull($column, $boolean = 'and', $not = false) |
|
464 | { |
||
465 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $boolean, $not]); |
|
466 | |||
467 | 1 | return $this; |
|
468 | } |
||
469 | |||
470 | /** |
||
471 | * Add an "or where null" clause to the query. |
||
472 | * |
||
473 | * @param string $column |
||
474 | * @return $this |
||
475 | */ |
||
476 | 1 | public function orWhereNull($column) |
|
477 | { |
||
478 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column]); |
|
479 | |||
480 | 1 | return $this; |
|
481 | } |
||
482 | |||
483 | /** |
||
484 | * Add a "where not null" clause to the query. |
||
485 | * |
||
486 | * @param string $column |
||
487 | * @param string $boolean |
||
488 | * @return $this |
||
489 | */ |
||
490 | 1 | public function whereNotNull($column, $boolean = 'and') |
|
491 | { |
||
492 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $boolean]); |
|
493 | |||
494 | 1 | return $this; |
|
495 | } |
||
496 | |||
497 | /** |
||
498 | * Add a where between statement to the query. |
||
499 | * |
||
500 | * @param string $column |
||
501 | * @param array $values |
||
502 | * @param string $boolean |
||
503 | * @param bool $not |
||
504 | * @return $this |
||
505 | */ |
||
506 | 3 | public function whereBetween($column, array $values, $boolean = 'and', $not = false) |
|
507 | { |
||
508 | 3 | $this->methods[] = new Method(__FUNCTION__, [$column, $values, $boolean, $not]); |
|
509 | |||
510 | 3 | return $this; |
|
511 | } |
||
512 | |||
513 | /** |
||
514 | * Add an or where between statement to the query. |
||
515 | * |
||
516 | * @param string $column |
||
517 | * @param array $values |
||
518 | * @return $this |
||
519 | */ |
||
520 | 1 | public function orWhereBetween($column, array $values) |
|
521 | { |
||
522 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $values]); |
|
523 | |||
524 | 1 | return $this; |
|
525 | } |
||
526 | |||
527 | /** |
||
528 | * Add a where not between statement to the query. |
||
529 | * |
||
530 | * @param string $column |
||
531 | * @param array $values |
||
532 | * @param string $boolean |
||
533 | * @return $this |
||
534 | */ |
||
535 | 1 | public function whereNotBetween($column, array $values, $boolean = 'and') |
|
536 | { |
||
537 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $values, $boolean]); |
|
538 | |||
539 | 1 | return $this; |
|
540 | } |
||
541 | |||
542 | /** |
||
543 | * Add an or where not between statement to the query. |
||
544 | * |
||
545 | * @param string $column |
||
546 | * @param array $values |
||
547 | * @return $this |
||
548 | */ |
||
549 | 1 | public function orWhereNotBetween($column, array $values) |
|
550 | { |
||
551 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $values]); |
|
552 | |||
553 | 1 | return $this; |
|
554 | } |
||
555 | |||
556 | /** |
||
557 | * Add an "or where not null" clause to the query. |
||
558 | * |
||
559 | * @param string $column |
||
560 | * @return $this |
||
561 | */ |
||
562 | 1 | public function orWhereNotNull($column) |
|
563 | { |
||
564 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column]); |
|
565 | |||
566 | 1 | return $this; |
|
567 | } |
||
568 | |||
569 | /** |
||
570 | * Add a "where date" statement to the query. |
||
571 | * |
||
572 | * @param string $column |
||
573 | * @param string $operator |
||
574 | * @param mixed $value |
||
575 | * @param string $boolean |
||
576 | * @return $this |
||
577 | */ |
||
578 | 1 | public function whereDate($column, $operator, $value = null, $boolean = 'and') |
|
579 | { |
||
580 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $operator, $value, $boolean]); |
|
581 | |||
582 | 1 | return $this; |
|
583 | } |
||
584 | |||
585 | /** |
||
586 | * Add an "or where date" statement to the query. |
||
587 | * |
||
588 | * @param string $column |
||
589 | * @param string $operator |
||
590 | * @param string $value |
||
591 | * @return $this |
||
592 | */ |
||
593 | 1 | public function orWhereDate($column, $operator, $value) |
|
594 | { |
||
595 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $operator, $value]); |
|
596 | |||
597 | 1 | return $this; |
|
598 | } |
||
599 | |||
600 | /** |
||
601 | * Add a "where time" statement to the query. |
||
602 | * |
||
603 | * @param string $column |
||
604 | * @param string $operator |
||
605 | * @param int $value |
||
606 | * @param string $boolean |
||
607 | * @return $this |
||
608 | */ |
||
609 | 1 | public function whereTime($column, $operator, $value, $boolean = 'and') |
|
610 | { |
||
611 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $operator, $value, $boolean]); |
|
612 | |||
613 | 1 | return $this; |
|
614 | } |
||
615 | |||
616 | /** |
||
617 | * Add an "or where time" statement to the query. |
||
618 | * |
||
619 | * @param string $column |
||
620 | * @param string $operator |
||
621 | * @param int $value |
||
622 | * @return $this |
||
623 | */ |
||
624 | 1 | public function orWhereTime($column, $operator, $value) |
|
625 | { |
||
626 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $operator, $value]); |
|
627 | |||
628 | 1 | return $this; |
|
629 | } |
||
630 | |||
631 | /** |
||
632 | * Add a "where day" statement to the query. |
||
633 | * |
||
634 | * @param string $column |
||
635 | * @param string $operator |
||
636 | * @param mixed $value |
||
637 | * @param string $boolean |
||
638 | * @return $this |
||
639 | */ |
||
640 | 1 | public function whereDay($column, $operator, $value = null, $boolean = 'and') |
|
641 | { |
||
642 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $operator, $value, $boolean]); |
|
643 | |||
644 | 1 | return $this; |
|
645 | } |
||
646 | |||
647 | /** |
||
648 | * Add a "where month" statement to the query. |
||
649 | * |
||
650 | * @param string $column |
||
651 | * @param string $operator |
||
652 | * @param mixed $value |
||
653 | * @param string $boolean |
||
654 | * @return $this |
||
655 | */ |
||
656 | 1 | public function whereMonth($column, $operator, $value = null, $boolean = 'and') |
|
657 | { |
||
658 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $operator, $value, $boolean]); |
|
659 | |||
660 | 1 | return $this; |
|
661 | } |
||
662 | |||
663 | /** |
||
664 | * Add a "where year" statement to the query. |
||
665 | * |
||
666 | * @param string $column |
||
667 | * @param string $operator |
||
668 | * @param mixed $value |
||
669 | * @param string $boolean |
||
670 | * @return $this |
||
671 | */ |
||
672 | 1 | public function whereYear($column, $operator, $value = null, $boolean = 'and') |
|
673 | { |
||
674 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $operator, $value, $boolean]); |
|
675 | |||
676 | 1 | return $this; |
|
677 | } |
||
678 | |||
679 | /** |
||
680 | * Add a nested where statement to the query. |
||
681 | * |
||
682 | * @param \Closure $callback |
||
683 | * @param string $boolean |
||
684 | * @return $this |
||
685 | */ |
||
686 | 1 | public function whereNested(Closure $callback, $boolean = 'and') |
|
687 | { |
||
688 | 1 | $this->methods[] = new Method(__FUNCTION__, [$callback, $boolean]); |
|
689 | |||
690 | 1 | return $this; |
|
691 | } |
||
692 | |||
693 | /** |
||
694 | * Add another query builder as a nested where to the query builder. |
||
695 | * |
||
696 | * @param $this $query |
||
0 ignored issues
–
show
|
|||
697 | * @param string $boolean |
||
698 | * @return $this |
||
699 | */ |
||
700 | 1 | public function addNestedWhereQuery($query, $boolean = 'and') |
|
701 | { |
||
702 | 1 | $this->methods[] = new Method(__FUNCTION__, [$query, $boolean]); |
|
703 | |||
704 | 1 | return $this; |
|
705 | } |
||
706 | |||
707 | /** |
||
708 | * Add an exists clause to the query. |
||
709 | * |
||
710 | * @param \Closure $callback |
||
711 | * @param string $boolean |
||
712 | * @param bool $not |
||
713 | * @return $this |
||
714 | */ |
||
715 | 1 | public function whereExists(Closure $callback, $boolean = 'and', $not = false) |
|
716 | { |
||
717 | 1 | $this->methods[] = new Method(__FUNCTION__, [$callback, $boolean, $not]); |
|
718 | |||
719 | 1 | return $this; |
|
720 | } |
||
721 | |||
722 | /** |
||
723 | * Add an or exists clause to the query. |
||
724 | * |
||
725 | * @param \Closure $callback |
||
726 | * @param bool $not |
||
727 | * @return $this |
||
728 | */ |
||
729 | 1 | public function orWhereExists(Closure $callback, $not = false) |
|
730 | { |
||
731 | 1 | $this->methods[] = new Method(__FUNCTION__, [$callback, $not]); |
|
732 | |||
733 | 1 | return $this; |
|
734 | } |
||
735 | |||
736 | /** |
||
737 | * Add a where not exists clause to the query. |
||
738 | * |
||
739 | * @param \Closure $callback |
||
740 | * @param string $boolean |
||
741 | * @return $this |
||
742 | */ |
||
743 | 1 | public function whereNotExists(Closure $callback, $boolean = 'and') |
|
744 | { |
||
745 | 1 | $this->methods[] = new Method(__FUNCTION__, [$callback, $boolean]); |
|
746 | |||
747 | 1 | return $this; |
|
748 | } |
||
749 | |||
750 | /** |
||
751 | * Add a where not exists clause to the query. |
||
752 | * |
||
753 | * @param \Closure $callback |
||
754 | * @return $this |
||
755 | */ |
||
756 | 1 | public function orWhereNotExists(Closure $callback) |
|
757 | { |
||
758 | 1 | $this->methods[] = new Method(__FUNCTION__, [$callback]); |
|
759 | |||
760 | 1 | return $this; |
|
761 | } |
||
762 | |||
763 | /** |
||
764 | * Add an exists clause to the query. |
||
765 | * |
||
766 | * @param \Illuminate\Database\Query\Builder $query |
||
767 | * @param string $boolean |
||
768 | * @param bool $not |
||
769 | * @return $this |
||
770 | */ |
||
771 | 1 | public function addWhereExistsQuery(Builder $query, $boolean = 'and', $not = false) |
|
772 | { |
||
773 | 1 | $this->methods[] = new Method(__FUNCTION__, [$query, $boolean, $not]); |
|
774 | |||
775 | 1 | return $this; |
|
776 | } |
||
777 | |||
778 | /** |
||
779 | * Handles dynamic "where" clauses to the query. |
||
780 | * |
||
781 | * @param string $method |
||
782 | * @param string $parameters |
||
783 | * @return $this |
||
784 | */ |
||
785 | 2 | public function dynamicWhere($method, $parameters) |
|
786 | { |
||
787 | 2 | $this->methods[] = new Method(__FUNCTION__, [$method, $parameters]); |
|
788 | |||
789 | 2 | return $this; |
|
790 | } |
||
791 | |||
792 | /** |
||
793 | * Add a "group by" clause to the query. |
||
794 | * |
||
795 | * @param array ...$groups |
||
796 | * @return $this |
||
797 | */ |
||
798 | 1 | public function groupBy() |
|
799 | { |
||
800 | 1 | $this->methods[] = new Method(__FUNCTION__, func_get_args()); |
|
801 | |||
802 | 1 | return $this; |
|
803 | } |
||
804 | |||
805 | /** |
||
806 | * Add a "having" clause to the query. |
||
807 | * |
||
808 | * @param string $column |
||
809 | * @param string $operator |
||
810 | * @param string $value |
||
811 | * @param string $boolean |
||
812 | * @return $this |
||
813 | */ |
||
814 | 1 | public function having($column, $operator = null, $value = null, $boolean = 'and') |
|
815 | { |
||
816 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $operator, $value, $boolean]); |
|
817 | |||
818 | 1 | return $this; |
|
819 | } |
||
820 | |||
821 | /** |
||
822 | * Add a "or having" clause to the query. |
||
823 | * |
||
824 | * @param string $column |
||
825 | * @param string $operator |
||
826 | * @param string $value |
||
827 | * @return $this |
||
828 | */ |
||
829 | 1 | public function orHaving($column, $operator = null, $value = null) |
|
830 | { |
||
831 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column, $operator, $value]); |
|
832 | |||
833 | 1 | return $this; |
|
834 | } |
||
835 | |||
836 | /** |
||
837 | * Add a raw having clause to the query. |
||
838 | * |
||
839 | * @param string $sql |
||
840 | * @param array $bindings |
||
841 | * @param string $boolean |
||
842 | * @return $this |
||
843 | */ |
||
844 | 1 | public function havingRaw($sql, array $bindings = [], $boolean = 'and') |
|
845 | { |
||
846 | 1 | $this->methods[] = new Method(__FUNCTION__, [$sql, $bindings, $boolean]); |
|
847 | |||
848 | 1 | return $this; |
|
849 | } |
||
850 | |||
851 | /** |
||
852 | * Add a raw or having clause to the query. |
||
853 | * |
||
854 | * @param string $sql |
||
855 | * @param array $bindings |
||
856 | * @return $this |
||
857 | */ |
||
858 | 1 | public function orHavingRaw($sql, array $bindings = []) |
|
859 | { |
||
860 | 1 | $this->methods[] = new Method(__FUNCTION__, [$sql, $bindings]); |
|
861 | |||
862 | 1 | return $this; |
|
863 | } |
||
864 | |||
865 | /** |
||
866 | * Add an "order by" clause to the query. |
||
867 | * |
||
868 | * @param string $column |
||
869 | * @param string $direction |
||
870 | * @return $this |
||
871 | */ |
||
872 | 4 | public function orderBy($column, $direction = 'asc') |
|
873 | { |
||
874 | 4 | $this->methods[] = new Method(__FUNCTION__, [$column, $direction]); |
|
875 | |||
876 | 4 | return $this; |
|
877 | } |
||
878 | |||
879 | /** |
||
880 | * Add a descending "order by" clause to the query. |
||
881 | * |
||
882 | * @param string $column |
||
883 | * @return $this |
||
884 | */ |
||
885 | 1 | public function orderByDesc($column) |
|
886 | { |
||
887 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column]); |
|
888 | |||
889 | 1 | return $this; |
|
890 | } |
||
891 | |||
892 | /** |
||
893 | * Add an "order by" clause for a timestamp to the query. |
||
894 | * |
||
895 | * @param string $column |
||
896 | * @return $this |
||
897 | */ |
||
898 | 1 | public function latest($column = 'created_at') |
|
899 | { |
||
900 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column]); |
|
901 | |||
902 | 1 | return $this; |
|
903 | } |
||
904 | |||
905 | /** |
||
906 | * Add an "order by" clause for a timestamp to the query. |
||
907 | * |
||
908 | * @param string $column |
||
909 | * @return $this |
||
910 | */ |
||
911 | 1 | public function oldest($column = 'created_at') |
|
912 | { |
||
913 | 1 | $this->methods[] = new Method(__FUNCTION__, [$column]); |
|
914 | |||
915 | 1 | return $this; |
|
916 | } |
||
917 | |||
918 | /** |
||
919 | * Put the query's results in random order. |
||
920 | * |
||
921 | * @param string $seed |
||
922 | * @return $this |
||
923 | */ |
||
924 | 1 | public function inRandomOrder($seed = '') |
|
925 | { |
||
926 | 1 | $this->methods[] = new Method(__FUNCTION__, [$seed]); |
|
927 | |||
928 | 1 | return $this; |
|
929 | } |
||
930 | |||
931 | /** |
||
932 | * Add a raw "order by" clause to the query. |
||
933 | * |
||
934 | * @param string $sql |
||
935 | * @param array $bindings |
||
936 | * @return $this |
||
937 | */ |
||
938 | 1 | public function orderByRaw($sql, $bindings = []) |
|
939 | { |
||
940 | 1 | $this->methods[] = new Method(__FUNCTION__, [$sql, $bindings]); |
|
941 | |||
942 | 1 | return $this; |
|
943 | } |
||
944 | |||
945 | /** |
||
946 | * Alias to set the "offset" value of the query. |
||
947 | * |
||
948 | * @param int $value |
||
949 | * @return $this |
||
950 | */ |
||
951 | 1 | public function skip($value) |
|
952 | { |
||
953 | 1 | $this->methods[] = new Method(__FUNCTION__, [$value]); |
|
954 | |||
955 | 1 | return $this; |
|
956 | } |
||
957 | |||
958 | /** |
||
959 | * Set the "offset" value of the query. |
||
960 | * |
||
961 | * @param int $value |
||
962 | * @return $this |
||
963 | */ |
||
964 | 1 | public function offset($value) |
|
965 | { |
||
966 | 1 | $this->methods[] = new Method(__FUNCTION__, [$value]); |
|
967 | |||
968 | 1 | return $this; |
|
969 | } |
||
970 | |||
971 | /** |
||
972 | * Alias to set the "limit" value of the query. |
||
973 | * |
||
974 | * @param int $value |
||
975 | * @return $this |
||
976 | */ |
||
977 | 1 | public function take($value) |
|
978 | { |
||
979 | 1 | $this->methods[] = new Method(__FUNCTION__, [$value]); |
|
980 | |||
981 | 1 | return $this; |
|
982 | } |
||
983 | |||
984 | /** |
||
985 | * Set the "limit" value of the query. |
||
986 | * |
||
987 | * @param int $value |
||
988 | * @return $this |
||
989 | */ |
||
990 | 1 | public function limit($value) |
|
991 | { |
||
992 | 1 | $this->methods[] = new Method(__FUNCTION__, [$value]); |
|
993 | |||
994 | 1 | return $this; |
|
995 | } |
||
996 | |||
997 | /** |
||
998 | * Set the limit and offset for a given page. |
||
999 | * |
||
1000 | * @param int $page |
||
1001 | * @param int $perPage |
||
1002 | * @return $this |
||
1003 | */ |
||
1004 | 1 | public function forPage($page, $perPage = 15) |
|
1005 | { |
||
1006 | 1 | $this->methods[] = new Method(__FUNCTION__, [$page, $perPage]); |
|
1007 | |||
1008 | 1 | return $this; |
|
1009 | } |
||
1010 | |||
1011 | /** |
||
1012 | * Constrain the query to the next "page" of results after a given ID. |
||
1013 | * |
||
1014 | * @param int $perPage |
||
1015 | * @param int $lastId |
||
1016 | * @param string $column |
||
1017 | * @return $this |
||
1018 | */ |
||
1019 | 1 | public function forPageAfterId($perPage = 15, $lastId = 0, $column = 'id') |
|
1020 | { |
||
1021 | 1 | $this->methods[] = new Method(__FUNCTION__, [$perPage, $lastId, $column]); |
|
1022 | |||
1023 | 1 | return $this; |
|
1024 | } |
||
1025 | |||
1026 | /** |
||
1027 | * Add a union statement to the query. |
||
1028 | * |
||
1029 | * @param \Illuminate\Database\Query\Builder|\Closure $query |
||
1030 | * @param bool $all |
||
1031 | * @return $this |
||
1032 | */ |
||
1033 | 1 | public function union($query, $all = false) |
|
1034 | { |
||
1035 | 1 | $this->methods[] = new Method(__FUNCTION__, [$query, $all]); |
|
1036 | |||
1037 | 1 | return $this; |
|
1038 | } |
||
1039 | |||
1040 | /** |
||
1041 | * Add a union all statement to the query. |
||
1042 | * |
||
1043 | * @param \Illuminate\Database\Query\Builder|\Closure $query |
||
1044 | * @return $this |
||
1045 | */ |
||
1046 | 1 | public function unionAll($query) |
|
1047 | { |
||
1048 | 1 | $this->methods[] = new Method(__FUNCTION__, [$query]); |
|
1049 | |||
1050 | 1 | return $this; |
|
1051 | } |
||
1052 | |||
1053 | /** |
||
1054 | * Lock the selected rows in the table. |
||
1055 | * |
||
1056 | * @param string|bool $value |
||
1057 | * @return $this |
||
1058 | */ |
||
1059 | 1 | public function lock($value = true) |
|
1060 | { |
||
1061 | 1 | $this->methods[] = new Method(__FUNCTION__, [$value]); |
|
1062 | |||
1063 | 1 | return $this; |
|
1064 | } |
||
1065 | |||
1066 | /** |
||
1067 | * Lock the selected rows in the table for updating. |
||
1068 | * |
||
1069 | * @return $this |
||
1070 | */ |
||
1071 | 1 | public function lockForUpdate() |
|
1072 | { |
||
1073 | 1 | $this->methods[] = new Method(__FUNCTION__); |
|
1074 | |||
1075 | 1 | return $this; |
|
1076 | } |
||
1077 | |||
1078 | /** |
||
1079 | * Share lock the selected rows in the table. |
||
1080 | * |
||
1081 | * @return $this |
||
1082 | */ |
||
1083 | 1 | public function sharedLock() |
|
1084 | { |
||
1085 | 1 | $this->methods[] = new Method(__FUNCTION__); |
|
1086 | |||
1087 | 1 | return $this; |
|
1088 | } |
||
1089 | |||
1090 | /** |
||
1091 | * Apply the callback's query changes if the given "value" is true. |
||
1092 | * |
||
1093 | * @param mixed $value |
||
1094 | * @param callable $callback |
||
1095 | * @param callable $default |
||
1096 | * @return $this |
||
1097 | */ |
||
1098 | 1 | public function when($value, $callback, $default = null) |
|
1099 | { |
||
1100 | 1 | $this->methods[] = new Method(__FUNCTION__, [$value, $callback, $default]); |
|
1101 | |||
1102 | 1 | return $this; |
|
1103 | } |
||
1104 | |||
1105 | /** |
||
1106 | * Apply the callback's query changes if the given "value" is false. |
||
1107 | * |
||
1108 | * @param mixed $value |
||
1109 | * @param callable $callback |
||
1110 | * @param callable $default |
||
1111 | * @return $this |
||
1112 | */ |
||
1113 | 1 | public function unless($value, $callback, $default = null) |
|
1114 | { |
||
1115 | 1 | $this->methods[] = new Method(__FUNCTION__, [$value, $callback, $default]); |
|
1116 | |||
1117 | 1 | return $this; |
|
1118 | } |
||
1119 | |||
1120 | /** |
||
1121 | * Use the write pdo for query. |
||
1122 | * |
||
1123 | * @return $this |
||
1124 | */ |
||
1125 | 2 | public function useWritePdo() |
|
1126 | { |
||
1127 | 2 | $this->methods[] = new Method(__FUNCTION__); |
|
1128 | |||
1129 | 2 | return $this; |
|
1130 | } |
||
1131 | } |
||
1132 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: