fomvasss /
laravel-taxonomy
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Fomvasss\Taxonomy\Models; |
||||
| 4 | |||||
| 5 | use Fomvasss\Taxonomy\Models\Traits\HasTaxonomyablesToMany; |
||||
| 6 | use Illuminate\Database\Eloquent\Model; |
||||
| 7 | use Illuminate\Database\Eloquent\SoftDeletes; |
||||
| 8 | |||||
| 9 | class Vocabulary extends Model |
||||
| 10 | { |
||||
| 11 | use HasTaxonomyablesToMany; |
||||
| 12 | |||||
| 13 | protected $guarded = ['id']; |
||||
| 14 | |||||
| 15 | public $timestamps = false; |
||||
| 16 | |||||
| 17 | protected $casts = [ |
||||
| 18 | 'options' => 'array', |
||||
| 19 | ]; |
||||
| 20 | |||||
| 21 | /** |
||||
| 22 | * Связь: |
||||
| 23 | * Словарь имеет много термов |
||||
| 24 | * |
||||
| 25 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||||
| 26 | */ |
||||
| 27 | public function terms() |
||||
| 28 | { |
||||
| 29 | $related = config('taxonomy.models.term', Term::class); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 30 | |||||
| 31 | return $this->hasMany($related, 'vocabulary'); |
||||
| 32 | } |
||||
| 33 | |||||
| 34 | /** |
||||
| 35 | * Связь: |
||||
| 36 | * Сущность текущей модели - словарь "держит" много термов |
||||
| 37 | * (полиморфная связь! - не используется в этом пакете для категоризации) |
||||
| 38 | * |
||||
| 39 | * @return $this |
||||
| 40 | */ |
||||
| 41 | public function termsByMany() |
||||
| 42 | { |
||||
| 43 | $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
Loading history...
|
|||||
| 44 | |||||
| 45 | return $this->morphedByMany($related, 'vocabularyable'); |
||||
|
0 ignored issues
–
show
|
|||||
| 46 | } |
||||
| 47 | |||||
| 48 | /** |
||||
| 49 | * Связь: |
||||
| 50 | * Сущность текущей модели - словарь "держит" много словарей |
||||
| 51 | * (полиморфная связь! - не используется в этом пакете для категоризации) |
||||
| 52 | * |
||||
| 53 | * @return $this |
||||
| 54 | */ |
||||
| 55 | public function vocabulariesByMany() |
||||
| 56 | { |
||||
| 57 | $related = config('taxonomy.models.vocabulary', static::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
Loading history...
|
|||||
| 58 | |||||
| 59 | return $this->morphedByMany($related, 'vocabularyable'); |
||||
|
0 ignored issues
–
show
|
|||||
| 60 | } |
||||
| 61 | } |
||||
| 62 |