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 | * |
||
| 61 | * @return [type] |
||
| 62 | */ |
||
| 63 | public function groupBy($field) |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Limit the number of results in the query. |
||
| 70 | * |
||
| 71 | * @param [number] |
||
| 72 | * |
||
| 73 | * @return [type] |
||
| 74 | */ |
||
| 75 | public function limit($number) |
||
| 79 | } |
||
| 80 |
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: