1 | <?php |
||
14 | trait Categorizable |
||
15 | { |
||
16 | /** |
||
17 | * Register a saved model event with the dispatcher. |
||
18 | * |
||
19 | * @param \Closure|string $callback |
||
20 | * |
||
21 | * @return void |
||
22 | */ |
||
23 | abstract public static function saved($callback); |
||
24 | |||
25 | /** |
||
26 | * Register a deleted model event with the dispatcher. |
||
27 | * |
||
28 | * @param \Closure|string $callback |
||
29 | * |
||
30 | * @return void |
||
31 | */ |
||
32 | abstract public static function deleted($callback); |
||
33 | |||
34 | /** |
||
35 | * Define a polymorphic many-to-many relationship. |
||
36 | * |
||
37 | * @param string $related |
||
38 | * @param string $name |
||
39 | * @param string $table |
||
|
|||
40 | * @param string $foreignPivotKey |
||
41 | * @param string $relatedPivotKey |
||
42 | * @param string $parentKey |
||
43 | * @param string $relatedKey |
||
44 | * @param bool $inverse |
||
45 | * |
||
46 | * @return \Illuminate\Database\Eloquent\Relations\MorphToMany |
||
47 | */ |
||
48 | abstract public function morphToMany( |
||
58 | |||
59 | /** |
||
60 | * Get all attached categories to the model. |
||
61 | * |
||
62 | * @return \Illuminate\Database\Eloquent\Relations\MorphToMany |
||
63 | */ |
||
64 | public function categories(): MorphToMany |
||
69 | |||
70 | /** |
||
71 | * Attach the given category(ies) to the model. |
||
72 | * |
||
73 | * @param int|string|array|\ArrayAccess|\Rinvex\Categories\Models\Category $categories |
||
74 | * |
||
75 | * @return void |
||
76 | */ |
||
77 | public function setCategoriesAttribute($categories): void |
||
83 | |||
84 | /** |
||
85 | * Boot the categorizable trait for the model. |
||
86 | * |
||
87 | * @return void |
||
88 | */ |
||
89 | public static function bootCategorizable() |
||
95 | |||
96 | /** |
||
97 | * Scope query with all the given categories. |
||
98 | * |
||
99 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
100 | * @param mixed $categories |
||
101 | * |
||
102 | * @return \Illuminate\Database\Eloquent\Builder |
||
103 | */ |
||
104 | public function scopeWithAllCategories(Builder $builder, $categories): Builder |
||
116 | |||
117 | /** |
||
118 | * Scope query with any of the given categories. |
||
119 | * |
||
120 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
121 | * @param mixed $categories |
||
122 | * |
||
123 | * @return \Illuminate\Database\Eloquent\Builder |
||
124 | */ |
||
125 | public function scopeWithAnyCategories(Builder $builder, $categories): Builder |
||
133 | |||
134 | /** |
||
135 | * Scope query with any of the given categories. |
||
136 | * |
||
137 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
138 | * @param mixed $categories |
||
139 | * |
||
140 | * @return \Illuminate\Database\Eloquent\Builder |
||
141 | */ |
||
142 | public function scopeWithCategories(Builder $builder, $categories): Builder |
||
146 | |||
147 | /** |
||
148 | * Scope query without any of the given categories. |
||
149 | * |
||
150 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
151 | * @param mixed $categories |
||
152 | * |
||
153 | * @return \Illuminate\Database\Eloquent\Builder |
||
154 | */ |
||
155 | public function scopeWithoutCategories(Builder $builder, $categories): Builder |
||
163 | |||
164 | /** |
||
165 | * Scope query without any categories. |
||
166 | * |
||
167 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
168 | * |
||
169 | * @return \Illuminate\Database\Eloquent\Builder |
||
170 | */ |
||
171 | public function scopeWithoutAnyCategories(Builder $builder): Builder |
||
175 | |||
176 | /** |
||
177 | * Determine if the model has any of the given categories. |
||
178 | * |
||
179 | * @param mixed $categories |
||
180 | * |
||
181 | * @return bool |
||
182 | */ |
||
183 | public function hasCategories($categories): bool |
||
189 | |||
190 | /** |
||
191 | * Determine if the model has any the given categories. |
||
192 | * |
||
193 | * @param mixed $categories |
||
194 | * |
||
195 | * @return bool |
||
196 | */ |
||
197 | public function hasAnyCategories($categories): bool |
||
201 | |||
202 | /** |
||
203 | * Determine if the model has all of the given categories. |
||
204 | * |
||
205 | * @param mixed $categories |
||
206 | * |
||
207 | * @return bool |
||
208 | */ |
||
209 | public function hasAllCategories($categories): bool |
||
215 | |||
216 | /** |
||
217 | * Sync model categories. |
||
218 | * |
||
219 | * @param mixed $categories |
||
220 | * @param bool $detaching |
||
221 | * |
||
222 | * @return $this |
||
223 | */ |
||
224 | public function syncCategories($categories, bool $detaching = true) |
||
234 | |||
235 | /** |
||
236 | * Attach model categories. |
||
237 | * |
||
238 | * @param mixed $categories |
||
239 | * |
||
240 | * @return $this |
||
241 | */ |
||
242 | public function attachCategories($categories) |
||
246 | |||
247 | /** |
||
248 | * Detach model categories. |
||
249 | * |
||
250 | * @param mixed $categories |
||
251 | * |
||
252 | * @return $this |
||
253 | */ |
||
254 | public function detachCategories($categories = null) |
||
263 | |||
264 | /** |
||
265 | * Prepare category IDs. |
||
266 | * |
||
267 | * @param mixed $categories |
||
268 | * |
||
269 | * @return array |
||
270 | */ |
||
271 | protected function prepareCategoryIds($categories): array |
||
302 | } |
||
303 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.