1 | <?php |
||||
2 | |||||
3 | namespace Fomvasss\Taxonomy\Models\Traits; |
||||
4 | |||||
5 | use Fomvasss\Taxonomy\Models\Term; |
||||
6 | use Fomvasss\Taxonomy\Models\Vocabulary; |
||||
7 | |||||
8 | /** |
||||
9 | * Сущность текущей модели "относится" к разным |
||||
10 | * словарям или термам |
||||
11 | * (для класса модели к которому подключен трейт - методы не используются для категоризации) |
||||
12 | * |
||||
13 | * Trait HasTaxonomyablesToMany |
||||
14 | * |
||||
15 | * @package App\Models\Traits |
||||
16 | */ |
||||
17 | trait HasTaxonomyablesToMany |
||||
18 | { |
||||
19 | /** |
||||
20 | * Сущность текущей модели "относится" к разным словарям. |
||||
21 | * Получить к список словарей, к которым относится. |
||||
22 | * |
||||
23 | * @return $this |
||||
24 | */ |
||||
25 | public function vocabulariesToMany() |
||||
26 | { |
||||
27 | $related = config('taxonomy.models.vocabulary', Vocabulary::class); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
28 | |||||
29 | return $this->morphToMany($related, 'vocabularyable'); |
||||
0 ignored issues
–
show
It seems like
morphToMany() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
30 | } |
||||
31 | |||||
32 | /** |
||||
33 | * Сущность текущей модели "относится" к разным термам. |
||||
34 | * Получить список термов, к которым относится. |
||||
35 | * |
||||
36 | * @return $this |
||||
37 | */ |
||||
38 | public function termsToMany() |
||||
39 | { |
||||
40 | $related = config('taxonomy.models.term', Term::class); |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
41 | |||||
42 | return $this->morphToMany($related, 'termable'); |
||||
43 | } |
||||
44 | } |
||||
45 |