1 | <?php |
||
24 | trait Eloquence |
||
25 | { |
||
26 | use Hookable; |
||
27 | |||
28 | /** |
||
29 | * Attribute mutator instance. |
||
30 | * |
||
31 | * @var \Sofa\Eloquence\Contracts\Mutator |
||
32 | */ |
||
33 | protected static $attributeMutator; |
||
34 | |||
35 | /** |
||
36 | * Model's table column listing. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | protected static $columnListing = []; |
||
41 | |||
42 | /** |
||
43 | * Boot the trait. |
||
44 | * |
||
45 | * @codeCoverageIgnore |
||
46 | * |
||
47 | * @return void |
||
48 | */ |
||
49 | public static function bootEloquence() |
||
61 | |||
62 | /** |
||
63 | * Determine whether where should be treated as whereNull. |
||
64 | * |
||
65 | * @param string $method |
||
66 | * @param Sofa\Hookable\Contracts\ArgumentBag $args |
||
67 | * @return boolean |
||
68 | */ |
||
69 | protected function isWhereNull($method, ArgumentBag $args) |
||
73 | |||
74 | /** |
||
75 | * Determine whether where is a whereNull by the arguments passed to where method. |
||
76 | * |
||
77 | * @param Sofa\Hookable\Contracts\ArgumentBag $args |
||
78 | * @return boolean |
||
79 | */ |
||
80 | protected function isWhereNullByArgs(ArgumentBag $args) |
||
85 | |||
86 | /** |
||
87 | * Extract real name and alias from the sql select clause. |
||
88 | * |
||
89 | * @param string $column |
||
90 | * @return array |
||
91 | */ |
||
92 | protected function extractColumnAlias($column) |
||
102 | |||
103 | /** |
||
104 | * Get the target relation and column from the mapping. |
||
105 | * |
||
106 | * @param string $mapping |
||
107 | * @return array |
||
108 | */ |
||
109 | public function parseMappedColumn($mapping) |
||
119 | |||
120 | /** |
||
121 | * Determine whether the key is meta attribute or actual table field. |
||
122 | * |
||
123 | * @param string $key |
||
124 | * @return boolean |
||
125 | */ |
||
126 | public static function hasColumn($key) |
||
132 | |||
133 | /** |
||
134 | * Get searchable columns defined on the model. |
||
135 | * |
||
136 | * @return array |
||
137 | */ |
||
138 | public function getSearchableColumns() |
||
142 | |||
143 | /** |
||
144 | * Get model table columns. |
||
145 | * |
||
146 | * @return array |
||
147 | */ |
||
148 | public static function getColumnListing() |
||
154 | |||
155 | /** |
||
156 | * Fetch model table columns. |
||
157 | * |
||
158 | * @return void |
||
159 | */ |
||
160 | protected static function loadColumnListing() |
||
170 | |||
171 | /** |
||
172 | * Create new Eloquence query builder for the instance. |
||
173 | * |
||
174 | * @param \Sofa\Eloquence\Query\Builder |
||
175 | * @return \Sofa\Eloquence\Builder |
||
176 | */ |
||
177 | public function newEloquentBuilder($query) |
||
181 | |||
182 | /** |
||
183 | * Get a new query builder instance for the connection. |
||
184 | * |
||
185 | * @return \Sofa\Eloquence\Query\Builder |
||
186 | */ |
||
187 | protected function newBaseQueryBuilder() |
||
195 | |||
196 | /** |
||
197 | * Set attribute mutator instance. |
||
198 | * |
||
199 | * @codeCoverageIgnore |
||
200 | * |
||
201 | * @param \Sofa\Eloquence\Contracts\Mutator $mutator |
||
202 | * @return void |
||
203 | */ |
||
204 | public static function setAttributeMutator(MutatorContract $mutator) |
||
208 | |||
209 | /** |
||
210 | * Get attribute mutator instance. |
||
211 | * |
||
212 | * @codeCoverageIgnore |
||
213 | * |
||
214 | * @return \Sofa\Eloquence\Contracts\Mutator |
||
215 | */ |
||
216 | public static function getAttributeMutator() |
||
220 | } |
||
221 |
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: