We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
5 | trait Query |
||
6 | { |
||
7 | // ---------------- |
||
8 | // ADVANCED QUERIES |
||
9 | // ---------------- |
||
10 | |||
11 | /** |
||
12 | * Add another clause to the query (for ex, a WHERE clause). |
||
13 | * |
||
14 | * Examples: |
||
15 | * // $this->crud->addClause('active'); |
||
16 | * $this->crud->addClause('type', 'car'); |
||
17 | * $this->crud->addClause('where', 'name', '==', 'car'); |
||
18 | * $this->crud->addClause('whereName', 'car'); |
||
19 | * $this->crud->addClause('whereHas', 'posts', function($query) { |
||
20 | * $query->activePosts(); |
||
21 | * }); |
||
22 | * |
||
23 | * @param [type] |
||
24 | */ |
||
25 | public function addClause($function) |
||
29 | |||
30 | /** |
||
31 | * Use eager loading to reduce the number of queries on the table view. |
||
32 | * |
||
33 | * @param [type] |
||
34 | * @param string |
||
35 | * |
||
36 | * @return [type] |
||
37 | */ |
||
38 | public function with($entities) |
||
42 | |||
43 | /** |
||
44 | * Order the results of the query in a certain way. |
||
45 | * |
||
46 | * @param [type] |
||
47 | * @param string |
||
48 | * |
||
49 | * @return [type] |
||
50 | */ |
||
51 | public function orderBy($field, $order = 'asc') |
||
55 | |||
56 | /** |
||
57 | * Group the results of the query in a certain way. |
||
58 | * |
||
59 | * @param [type] |
||
60 | * @return [type] |
||
61 | */ |
||
62 | public function groupBy($field) |
||
66 | |||
67 | /** |
||
68 | * Limit the number of results in the query. |
||
69 | * |
||
70 | * @param [number] |
||
71 | * @return [type] |
||
72 | */ |
||
73 | public function limit($number) |
||
77 | |||
78 | /** |
||
79 | * Take a certain number of results from the query. |
||
80 | * |
||
81 | * @param [number] |
||
82 | * @return [type] |
||
83 | */ |
||
84 | public function take($number) |
||
88 | |||
89 | /** |
||
90 | * Start the result set from a certain number. |
||
91 | * |
||
92 | * @param int $number [description] |
||
93 | * @return [type] [description] |
||
94 | */ |
||
95 | public function skip($number) |
||
99 | |||
100 | /** |
||
101 | * Count the number of results. |
||
102 | */ |
||
103 | public function count() |
||
107 | } |
||
108 |
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: