1 | <?php |
||
8 | trait EloquentBuildsQueries |
||
9 | { |
||
10 | /** |
||
11 | * Add a where clause on the primary key to the query. |
||
12 | * |
||
13 | * @param mixed $id |
||
14 | * @return $this |
||
15 | */ |
||
16 | public function whereKey($id) |
||
22 | |||
23 | /** |
||
24 | * Add a where clause on the primary key to the query. |
||
25 | * |
||
26 | * @param mixed $id |
||
27 | * @return $this |
||
28 | */ |
||
29 | public function whereKeyNot($id) |
||
35 | |||
36 | /** |
||
37 | * Set the relationships that should be eager loaded. |
||
38 | * |
||
39 | * @param mixed $relations |
||
40 | * @return $this |
||
41 | */ |
||
42 | public function with($relations) |
||
48 | |||
49 | /** |
||
50 | * Prevent the specified relations from being eager loaded. |
||
51 | * |
||
52 | * @param mixed $relations |
||
53 | * @return $this |
||
54 | */ |
||
55 | public function without($relations) |
||
61 | |||
62 | /** |
||
63 | * Set the underlying query builder instance. |
||
64 | * |
||
65 | * @param \Illuminate\Database\Query\Builder $query |
||
66 | * @return $this |
||
67 | */ |
||
68 | public function setQuery($query) |
||
74 | |||
75 | /** |
||
76 | * Set a model instance for the model being queried. |
||
77 | * |
||
78 | * @param \Illuminate\Database\Eloquent\Model $model |
||
79 | * @return $this |
||
80 | */ |
||
81 | public function setModel(Model $model) |
||
87 | } |
||
88 |
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: