hasMany(Delivery::class); } public function price_lists() { return $this->hasMany(PriceList::class); } public function tariffs() { return $this->hasManyThrough(Tariff::class, PriceList::class, 'sale_channel_id', 'id', 'id', 'tariff_id'); } public function scopeByCode($query, $code) { return $query->where($this->table.'.code', $code); } }