1 | <?php |
||
23 | trait Eloquence |
||
24 | { |
||
25 | use Hookable; |
||
26 | |||
27 | /** |
||
28 | * Model's table column listing. |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | protected static $columnListing = []; |
||
33 | |||
34 | /** |
||
35 | * Boot the trait. |
||
36 | * |
||
37 | * @codeCoverageIgnore |
||
38 | * |
||
39 | * @return void |
||
40 | */ |
||
41 | public static function bootEloquence() |
||
45 | |||
46 | /** |
||
47 | * Determine whether where should be treated as whereNull. |
||
48 | * |
||
49 | * @param string $method |
||
50 | * @param ArgumentBag $args |
||
51 | * @return bool |
||
52 | */ |
||
53 | protected function isWhereNull($method, ArgumentBag $args) |
||
57 | |||
58 | /** |
||
59 | * Determine whether where is a whereNull by the arguments passed to where method. |
||
60 | * |
||
61 | * @param ArgumentBag $args |
||
62 | * @return bool |
||
63 | */ |
||
64 | protected function isWhereNullByArgs(ArgumentBag $args) |
||
69 | |||
70 | /** |
||
71 | * Extract real name and alias from the sql select clause. |
||
72 | * |
||
73 | * @param string $column |
||
74 | * @return array |
||
75 | */ |
||
76 | protected function extractColumnAlias($column) |
||
86 | |||
87 | /** |
||
88 | * Get the target relation and column from the mapping. |
||
89 | * |
||
90 | * @param string $mapping |
||
91 | * @return array |
||
92 | */ |
||
93 | public function parseMappedColumn($mapping) |
||
103 | |||
104 | /** |
||
105 | * Determine whether the key is meta attribute or actual table field. |
||
106 | * |
||
107 | * @param string $key |
||
108 | * @return bool |
||
109 | */ |
||
110 | public static function hasColumn($key) |
||
116 | |||
117 | /** |
||
118 | * Get searchable columns defined on the model. |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | public function getSearchableColumns() |
||
126 | |||
127 | /** |
||
128 | * Get model table columns. |
||
129 | * |
||
130 | * @return array |
||
131 | */ |
||
132 | public static function getColumnListing() |
||
138 | |||
139 | /** |
||
140 | * Fetch model table columns. |
||
141 | * |
||
142 | * @return void |
||
143 | */ |
||
144 | protected static function loadColumnListing() |
||
154 | |||
155 | /** |
||
156 | * Create new Eloquence query builder for the instance. |
||
157 | * |
||
158 | * @param QueryBuilder $query |
||
159 | * @return Builder |
||
160 | */ |
||
161 | public function newEloquentBuilder($query) |
||
165 | |||
166 | /** |
||
167 | * Get a new query builder instance for the connection. |
||
168 | * |
||
169 | * @return QueryBuilder |
||
170 | */ |
||
171 | protected function newBaseQueryBuilder() |
||
179 | } |
||
180 |
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: