СПРОСИ ПРОФИ

Виталий Вороник

Пользователь Ask.profi.ru
Вопросов1
Ответов 0
Рейтинг 0

Вопросы:


👍
0
👎

Eloquent   0 ответов

model Product

есть основная единица измерения Unit
return $this
->belongsTo(Unit::class, 'base_unit', 'id');
model Unit

есть производные единицы
public function units()
{
return $this
->morphedByMany(Unit::class, 'unitable')
->withPivot('multiplier', 'product_id', 'main');
}

отфильтровать товары через belongsTo модель где morphtoMany имеет pivot('main', 1)

ASK.PROFI.RU © 2020-2024